<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span class="hs-comment">{-
(c) The University of Glasgow 2006
(c) The GRASP/AQUA Project, Glasgow University, 1992-1998
-}</span><span>
</span><span id="line-5"></span><span>
</span><span id="line-6"></span><span class="hs-pragma">{-# LANGUAGE RankNTypes #-}</span><span>
</span><span id="line-7"></span><span class="hs-pragma">{-# LANGUAGE TypeFamilies #-}</span><span>
</span><span id="line-8"></span><span class="hs-pragma">{-# LANGUAGE FlexibleContexts #-}</span><span>
</span><span id="line-9"></span><span class="hs-pragma">{-# LANGUAGE TypeSynonymInstances #-}</span><span>
</span><span id="line-10"></span><span class="hs-pragma">{-# LANGUAGE FlexibleInstances #-}</span><span>
</span><span id="line-11"></span><span class="hs-pragma">{-# LANGUAGE UndecidableInstances #-}</span><span>
</span><span id="line-12"></span><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">GHC.Data.TrieMap</span><span class="hs-special">(</span><span>
</span><span id="line-13"></span><span>   </span><span class="annot"><span class="hs-comment">-- * Maps over 'Maybe' values</span></span><span>
</span><span id="line-14"></span><span>   </span><span class="annot"><a href="GHC.Data.TrieMap.html#MaybeMap"><span class="hs-identifier">MaybeMap</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-15"></span><span>   </span><span class="annot"><span class="hs-comment">-- * Maps over 'List' values</span></span><span>
</span><span id="line-16"></span><span>   </span><span class="annot"><a href="GHC.Data.TrieMap.html#ListMap"><span class="hs-identifier">ListMap</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-17"></span><span>   </span><span class="annot"><span class="hs-comment">-- * Maps over 'Literal's</span></span><span>
</span><span id="line-18"></span><span>   </span><span class="annot"><a href="GHC.Data.TrieMap.html#LiteralMap"><span class="hs-identifier">LiteralMap</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-19"></span><span>   </span><span class="annot"><span class="hs-comment">-- * 'TrieMap' class</span></span><span>
</span><span id="line-20"></span><span>   </span><span class="annot"><a href="GHC.Data.TrieMap.html#TrieMap"><span class="hs-identifier">TrieMap</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Data.TrieMap.html#insertTM"><span class="hs-identifier">insertTM</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Data.TrieMap.html#deleteTM"><span class="hs-identifier">deleteTM</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-21"></span><span>
</span><span id="line-22"></span><span>   </span><span class="annot"><span class="hs-comment">-- * Things helpful for adding additional Instances.</span></span><span>
</span><span id="line-23"></span><span>   </span><span class="annot"><a href="GHC.Data.TrieMap.html#%3E.%3E"><span class="hs-operator">(&gt;.&gt;)</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Data.TrieMap.html#%7C%3E"><span class="hs-operator">(|&gt;)</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Data.TrieMap.html#%7C%3E%3E"><span class="hs-operator">(|&gt;&gt;)</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Data.TrieMap.html#XT"><span class="hs-identifier">XT</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-24"></span><span>   </span><span class="annot"><a href="GHC.Data.TrieMap.html#foldMaybe"><span class="hs-identifier">foldMaybe</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-25"></span><span>   </span><span class="annot"><span class="hs-comment">-- * Map for leaf compression</span></span><span>
</span><span id="line-26"></span><span>   </span><span class="annot"><a href="GHC.Data.TrieMap.html#GenMap"><span class="hs-identifier">GenMap</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-27"></span><span>   </span><span class="annot"><a href="GHC.Data.TrieMap.html#lkG"><span class="hs-identifier">lkG</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Data.TrieMap.html#xtG"><span class="hs-identifier">xtG</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Data.TrieMap.html#mapG"><span class="hs-identifier">mapG</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Data.TrieMap.html#fdG"><span class="hs-identifier">fdG</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-28"></span><span>   </span><span class="annot"><a href="GHC.Data.TrieMap.html#xtList"><span class="hs-identifier">xtList</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Data.TrieMap.html#lkList"><span class="hs-identifier">lkList</span></a></span><span>
</span><span id="line-29"></span><span>
</span><span id="line-30"></span><span> </span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-31"></span><span>
</span><span id="line-32"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Prelude.html"><span class="hs-identifier">GHC.Prelude</span></a></span><span>
</span><span id="line-33"></span><span>
</span><span id="line-34"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Literal.html"><span class="hs-identifier">GHC.Types.Literal</span></a></span><span>
</span><span id="line-35"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Unique.DFM.html"><span class="hs-identifier">GHC.Types.Unique.DFM</span></a></span><span>
</span><span id="line-36"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Unique.html"><span class="hs-identifier">GHC.Types.Unique</span></a></span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Types.Unique.html#Uniquable"><span class="hs-identifier">Uniquable</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-37"></span><span>
</span><span id="line-38"></span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="annot"><a href="../../containers/src/Data.Map.html#"><span class="hs-identifier">Data.Map</span></a></span><span>    </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">Map</span></span><span>
</span><span id="line-39"></span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="annot"><a href="../../containers/src/Data.IntMap.html#"><span class="hs-identifier">Data.IntMap</span></a></span><span> </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">IntMap</span></span><span>
</span><span id="line-40"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html"><span class="hs-identifier">GHC.Utils.Outputable</span></a></span><span>
</span><span id="line-41"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Control.Monad.html#"><span class="hs-identifier">Control.Monad</span></a></span><span class="hs-special">(</span><span> </span><span class="annot"><a href="../../base/src/Control.Monad.html#%3E%3D%3E"><span class="hs-operator">(&gt;=&gt;)</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-42"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Data.Kind.html#"><span class="hs-identifier">Data.Kind</span></a></span><span class="hs-special">(</span><span> </span><span class="annot"><span class="hs-identifier">Type</span></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-43"></span><span>
</span><span id="line-44"></span><span class="hs-comment">{-
This module implements TrieMaps, which are finite mappings
whose key is a structured value like a CoreExpr or Type.

This file implements tries over general data structures.
Implementation for tries over Core Expressions/Types are
available in GHC.Core.Map.

The regular pattern for handling TrieMaps on data structures was first
described (to my knowledge) in Connelly and Morris's 1995 paper &quot;A
generalization of the Trie Data Structure&quot;; there is also an accessible
description of the idea in Okasaki's book &quot;Purely Functional Data
Structures&quot;, Section 10.3.2

************************************************************************
*                                                                      *
                   The TrieMap class
*                                                                      *
************************************************************************
-}</span><span>
</span><span id="line-64"></span><span>
</span><span id="line-65"></span><span class="hs-keyword">type</span><span> </span><span id="XT"><span class="annot"><a href="GHC.Data.TrieMap.html#XT"><span class="hs-identifier hs-var">XT</span></a></span></span><span> </span><span id="local-6989586621680857570"><span class="annot"><a href="#local-6989586621680857570"><span class="hs-identifier hs-type">a</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857570"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857570"><span class="hs-identifier hs-type">a</span></a></span><span>  </span><span class="hs-comment">-- How to alter a non-existent elt (Nothing)</span><span>
</span><span id="line-66"></span><span>                                </span><span class="hs-comment">--               or an existing elt (Just)</span><span>
</span><span id="line-67"></span><span>
</span><span id="line-68"></span><span class="hs-keyword">class</span><span> </span><span id="TrieMap"><span class="annot"><a href="GHC.Data.TrieMap.html#TrieMap"><span class="hs-identifier hs-var">TrieMap</span></a></span></span><span> </span><span id="local-6989586621680857823"><span class="annot"><a href="#local-6989586621680857823"><span class="hs-identifier hs-type">m</span></a></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-69"></span><span>   </span><span class="hs-keyword">type</span><span> </span><span id="Key"><span class="annot"><a href="GHC.Data.TrieMap.html#Key"><span class="hs-identifier hs-var">Key</span></a></span></span><span> </span><span id="local-6989586621680857823"><span class="annot"><a href="#local-6989586621680857823"><span class="hs-identifier hs-type">m</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Type</span></span><span>
</span><span id="line-70"></span><span>   </span><span id="local-6989586621680857793"><span id="emptyTM"><span class="annot"><a href="GHC.Data.TrieMap.html#emptyTM"><span class="hs-identifier hs-type">emptyTM</span></a></span></span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="#local-6989586621680857823"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857793"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-71"></span><span>   </span><span id="lookupTM"><span class="annot"><a href="GHC.Data.TrieMap.html#lookupTM"><span class="hs-identifier hs-type">lookupTM</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-keyword">forall</span><span> </span><span id="local-6989586621680857791"><span class="annot"><a href="#local-6989586621680857791"><span class="hs-identifier hs-type">b</span></a></span></span><span class="hs-operator">.</span><span> </span><span class="annot"><a href="GHC.Data.TrieMap.html#Key"><span class="hs-identifier hs-type">Key</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857823"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680857823"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857791"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857791"><span class="hs-identifier hs-type">b</span></a></span><span>
</span><span id="line-72"></span><span>   </span><span id="alterTM"><span class="annot"><a href="GHC.Data.TrieMap.html#alterTM"><span class="hs-identifier hs-type">alterTM</span></a></span></span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="hs-keyword">forall</span><span> </span><span id="local-6989586621680857822"><span class="annot"><a href="#local-6989586621680857822"><span class="hs-identifier hs-type">b</span></a></span></span><span class="hs-operator">.</span><span> </span><span class="annot"><a href="GHC.Data.TrieMap.html#Key"><span class="hs-identifier hs-type">Key</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857823"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.TrieMap.html#XT"><span class="hs-identifier hs-type">XT</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857822"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680857823"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857822"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680857823"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857822"><span class="hs-identifier hs-type">b</span></a></span><span>
</span><span id="line-73"></span><span>   </span><span id="local-6989586621680857789"><span id="local-6989586621680857790"><span id="mapTM"><span class="annot"><a href="GHC.Data.TrieMap.html#mapTM"><span class="hs-identifier hs-type">mapTM</span></a></span></span><span>    </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680857790"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-glyph">-&gt;</span><span class="annot"><a href="#local-6989586621680857789"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680857823"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857790"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680857823"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857789"><span class="hs-identifier hs-type">b</span></a></span></span></span><span>
</span><span id="line-74"></span><span>
</span><span id="line-75"></span><span>   </span><span id="local-6989586621680857787"><span id="local-6989586621680857788"><span id="foldTM"><span class="annot"><a href="GHC.Data.TrieMap.html#foldTM"><span class="hs-identifier hs-type">foldTM</span></a></span></span><span>   </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680857788"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680857787"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680857787"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680857823"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857788"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680857787"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680857787"><span class="hs-identifier hs-type">b</span></a></span></span></span><span>
</span><span id="line-76"></span><span>      </span><span class="hs-comment">-- The unusual argument order here makes</span><span>
</span><span id="line-77"></span><span>      </span><span class="hs-comment">-- it easy to compose calls to foldTM;</span><span>
</span><span id="line-78"></span><span>      </span><span class="hs-comment">-- see for example fdE below</span><span>
</span><span id="line-79"></span><span>
</span><span id="line-80"></span><span id="local-6989586621680857827"><span id="local-6989586621680857829"><span class="annot"><a href="GHC.Data.TrieMap.html#insertTM"><span class="hs-identifier hs-type">insertTM</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Data.TrieMap.html#TrieMap"><span class="hs-identifier hs-type">TrieMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857829"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="GHC.Data.TrieMap.html#Key"><span class="hs-identifier hs-type">Key</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857829"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680857827"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680857829"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857827"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680857829"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857827"><span class="hs-identifier hs-type">a</span></a></span></span></span><span>
</span><span id="line-81"></span><span id="insertTM"><span class="annot"><span class="annottext">insertTM :: forall (m :: * -&gt; *) a. TrieMap m =&gt; Key m -&gt; a -&gt; m a -&gt; m a
</span><a href="GHC.Data.TrieMap.html#insertTM"><span class="hs-identifier hs-var hs-var">insertTM</span></a></span></span><span> </span><span id="local-6989586621680857562"><span class="annot"><span class="annottext">Key m
</span><a href="#local-6989586621680857562"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span id="local-6989586621680857561"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680857561"><span class="hs-identifier hs-var">v</span></a></span></span><span> </span><span id="local-6989586621680857560"><span class="annot"><span class="annottext">m a
</span><a href="#local-6989586621680857560"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Key m -&gt; XT a -&gt; m a -&gt; m a
forall (m :: * -&gt; *) b. TrieMap m =&gt; Key m -&gt; XT b -&gt; m b -&gt; m b
</span><a href="GHC.Data.TrieMap.html#alterTM"><span class="hs-identifier hs-var">alterTM</span></a></span><span> </span><span class="annot"><span class="annottext">Key m
</span><a href="#local-6989586621680857562"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="annot"><span class="annottext">Maybe a
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">a -&gt; Maybe a
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680857561"><span class="hs-identifier hs-var">v</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">m a
</span><a href="#local-6989586621680857560"><span class="hs-identifier hs-var">m</span></a></span><span>
</span><span id="line-82"></span><span>
</span><span id="line-83"></span><span id="local-6989586621680857819"><span id="local-6989586621680857820"><span class="annot"><a href="GHC.Data.TrieMap.html#deleteTM"><span class="hs-identifier hs-type">deleteTM</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Data.TrieMap.html#TrieMap"><span class="hs-identifier hs-type">TrieMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857820"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="GHC.Data.TrieMap.html#Key"><span class="hs-identifier hs-type">Key</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857820"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680857820"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857819"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680857820"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857819"><span class="hs-identifier hs-type">a</span></a></span></span></span><span>
</span><span id="line-84"></span><span id="deleteTM"><span class="annot"><span class="annottext">deleteTM :: forall (m :: * -&gt; *) a. TrieMap m =&gt; Key m -&gt; m a -&gt; m a
</span><a href="GHC.Data.TrieMap.html#deleteTM"><span class="hs-identifier hs-var hs-var">deleteTM</span></a></span></span><span> </span><span id="local-6989586621680857557"><span class="annot"><span class="annottext">Key m
</span><a href="#local-6989586621680857557"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span id="local-6989586621680857556"><span class="annot"><span class="annottext">m a
</span><a href="#local-6989586621680857556"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Key m -&gt; XT a -&gt; m a -&gt; m a
forall (m :: * -&gt; *) b. TrieMap m =&gt; Key m -&gt; XT b -&gt; m b -&gt; m b
</span><a href="GHC.Data.TrieMap.html#alterTM"><span class="hs-identifier hs-var">alterTM</span></a></span><span> </span><span class="annot"><span class="annottext">Key m
</span><a href="#local-6989586621680857557"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="annot"><span class="annottext">Maybe a
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Maybe a
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">m a
</span><a href="#local-6989586621680857556"><span class="hs-identifier hs-var">m</span></a></span><span>
</span><span id="line-85"></span><span>
</span><span id="line-86"></span><span class="hs-comment">----------------------</span><span>
</span><span id="line-87"></span><span class="hs-comment">-- Recall that</span><span>
</span><span id="line-88"></span><span class="hs-comment">--   Control.Monad.(&gt;=&gt;) :: (a -&gt; Maybe b) -&gt; (b -&gt; Maybe c) -&gt; a -&gt; Maybe c</span><span>
</span><span id="line-89"></span><span>
</span><span id="line-90"></span><span id="local-6989586621680857814"><span id="local-6989586621680857815"><span id="local-6989586621680857816"><span class="annot"><a href="GHC.Data.TrieMap.html#%3E.%3E"><span class="hs-operator hs-type">(&gt;.&gt;)</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680857816"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680857815"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680857815"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680857814"><span class="hs-identifier hs-type">c</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680857816"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680857814"><span class="hs-identifier hs-type">c</span></a></span></span></span></span><span>
</span><span id="line-91"></span><span class="hs-comment">-- Reverse function composition (do f first, then g)</span><span>
</span><span id="line-92"></span><span class="hs-keyword">infixr</span><span> </span><span class="hs-number">1</span><span> </span><span class="annot"><a href="GHC.Data.TrieMap.html#%3E.%3E"><span class="hs-operator hs-type">&gt;.&gt;</span></a></span><span>
</span><span id="line-93"></span><span class="hs-special">(</span><span id="local-6989586621680857555"><span class="annot"><span class="annottext">a -&gt; b
</span><a href="#local-6989586621680857555"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="%3E.%3E"><span class="annot"><span class="annottext">&gt;.&gt; :: forall a b c. (a -&gt; b) -&gt; (b -&gt; c) -&gt; a -&gt; c
</span><a href="GHC.Data.TrieMap.html#%3E.%3E"><span class="hs-operator hs-var hs-var">&gt;.&gt;</span></a></span></span><span> </span><span id="local-6989586621680857554"><span class="annot"><span class="annottext">b -&gt; c
</span><a href="#local-6989586621680857554"><span class="hs-identifier hs-var">g</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621680857553"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680857553"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">b -&gt; c
</span><a href="#local-6989586621680857554"><span class="hs-identifier hs-var">g</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; b
</span><a href="#local-6989586621680857555"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680857553"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-94"></span><span class="hs-keyword">infixr</span><span> </span><span class="hs-number">1</span><span> </span><span class="annot"><a href="GHC.Data.TrieMap.html#%7C%3E"><span class="hs-operator hs-type">|&gt;</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Data.TrieMap.html#%7C%3E%3E"><span class="hs-operator hs-type">|&gt;&gt;</span></a></span><span>
</span><span id="line-95"></span><span>
</span><span id="line-96"></span><span id="local-6989586621680857809"><span id="local-6989586621680857810"><span class="annot"><a href="GHC.Data.TrieMap.html#%7C%3E"><span class="hs-operator hs-type">(|&gt;)</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="#local-6989586621680857810"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680857810"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-glyph">-&gt;</span><span class="annot"><a href="#local-6989586621680857809"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680857809"><span class="hs-identifier hs-type">b</span></a></span></span></span><span>     </span><span class="hs-comment">-- Reverse application</span><span>
</span><span id="line-97"></span><span id="local-6989586621680857552"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680857552"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="%7C%3E"><span class="annot"><span class="annottext">|&gt; :: forall a b. a -&gt; (a -&gt; b) -&gt; b
</span><a href="GHC.Data.TrieMap.html#%7C%3E"><span class="hs-operator hs-var hs-var">|&gt;</span></a></span></span><span> </span><span id="local-6989586621680857551"><span class="annot"><span class="annottext">a -&gt; b
</span><a href="#local-6989586621680857551"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; b
</span><a href="#local-6989586621680857551"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680857552"><span class="hs-identifier hs-var">x</span></a></span><span>
</span><span id="line-98"></span><span>
</span><span id="line-99"></span><span class="hs-comment">----------------------</span><span>
</span><span id="line-100"></span><span id="local-6989586621680857804"><span id="local-6989586621680857805"><span id="local-6989586621680857806"><span class="annot"><a href="GHC.Data.TrieMap.html#%7C%3E%3E"><span class="hs-operator hs-type">(|&gt;&gt;)</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Data.TrieMap.html#TrieMap"><span class="hs-identifier hs-type">TrieMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857806"><span class="hs-identifier hs-type">m2</span></a></span><span>
</span><span id="line-101"></span><span>      </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.TrieMap.html#XT"><span class="hs-identifier hs-type">XT</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680857806"><span class="hs-identifier hs-type">m2</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857805"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680857804"><span class="hs-identifier hs-type">m1</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680857806"><span class="hs-identifier hs-type">m2</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857805"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680857804"><span class="hs-identifier hs-type">m1</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680857806"><span class="hs-identifier hs-type">m2</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857805"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-102"></span><span>      </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680857806"><span class="hs-identifier hs-type">m2</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857805"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680857806"><span class="hs-identifier hs-type">m2</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857805"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-103"></span><span>      </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680857804"><span class="hs-identifier hs-type">m1</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680857806"><span class="hs-identifier hs-type">m2</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857805"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680857804"><span class="hs-identifier hs-type">m1</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680857806"><span class="hs-identifier hs-type">m2</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857805"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span></span></span></span><span>
</span><span id="line-104"></span><span id="%7C%3E%3E"><span class="annot"><span class="annottext">|&gt;&gt; :: forall (m2 :: * -&gt; *) a (m1 :: * -&gt; *).
TrieMap m2 =&gt;
(XT (m2 a) -&gt; m1 (m2 a) -&gt; m1 (m2 a))
-&gt; (m2 a -&gt; m2 a) -&gt; m1 (m2 a) -&gt; m1 (m2 a)
</span><a href="GHC.Data.TrieMap.html#%7C%3E%3E"><span class="hs-operator hs-var hs-var">(|&gt;&gt;)</span></a></span></span><span> </span><span id="local-6989586621680857548"><span class="annot"><span class="annottext">XT (m2 a) -&gt; m1 (m2 a) -&gt; m1 (m2 a)
</span><a href="#local-6989586621680857548"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621680857547"><span class="annot"><span class="annottext">m2 a -&gt; m2 a
</span><a href="#local-6989586621680857547"><span class="hs-identifier hs-var">g</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">XT (m2 a) -&gt; m1 (m2 a) -&gt; m1 (m2 a)
</span><a href="#local-6989586621680857548"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">m2 a -&gt; Maybe (m2 a)
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">(m2 a -&gt; Maybe (m2 a)) -&gt; (Maybe (m2 a) -&gt; m2 a) -&gt; XT (m2 a)
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">m2 a -&gt; m2 a
</span><a href="#local-6989586621680857547"><span class="hs-identifier hs-var">g</span></a></span><span> </span><span class="annot"><span class="annottext">(m2 a -&gt; m2 a) -&gt; (Maybe (m2 a) -&gt; m2 a) -&gt; Maybe (m2 a) -&gt; m2 a
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe (m2 a) -&gt; m2 a
forall (m :: * -&gt; *) a. TrieMap m =&gt; Maybe (m a) -&gt; m a
</span><a href="GHC.Data.TrieMap.html#deMaybe"><span class="hs-identifier hs-var">deMaybe</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-105"></span><span>
</span><span id="line-106"></span><span id="local-6989586621680857796"><span id="local-6989586621680857797"><span class="annot"><a href="GHC.Data.TrieMap.html#deMaybe"><span class="hs-identifier hs-type">deMaybe</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Data.TrieMap.html#TrieMap"><span class="hs-identifier hs-type">TrieMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857797"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680857797"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857796"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680857797"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857796"><span class="hs-identifier hs-type">a</span></a></span></span></span><span>
</span><span id="line-107"></span><span id="deMaybe"><span class="annot"><span class="annottext">deMaybe :: forall (m :: * -&gt; *) a. TrieMap m =&gt; Maybe (m a) -&gt; m a
</span><a href="GHC.Data.TrieMap.html#deMaybe"><span class="hs-identifier hs-var hs-var">deMaybe</span></a></span></span><span> </span><span class="annot"><span class="annottext">Maybe (m a)
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">m a
forall (m :: * -&gt; *) a. TrieMap m =&gt; m a
</span><a href="GHC.Data.TrieMap.html#emptyTM"><span class="hs-identifier hs-var">emptyTM</span></a></span><span>
</span><span id="line-108"></span><span class="annot"><a href="GHC.Data.TrieMap.html#deMaybe"><span class="hs-identifier hs-var">deMaybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621680857542"><span class="annot"><span class="annottext">m a
</span><a href="#local-6989586621680857542"><span class="hs-identifier hs-var">m</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">m a
</span><a href="#local-6989586621680857542"><span class="hs-identifier hs-var">m</span></a></span><span>
</span><span id="line-109"></span><span>
</span><span id="line-110"></span><span class="hs-comment">{-
************************************************************************
*                                                                      *
                   IntMaps
*                                                                      *
************************************************************************
-}</span><span>
</span><span id="line-117"></span><span>
</span><span id="line-118"></span><span class="hs-keyword">instance</span><span> </span><span class="annot"><a href="GHC.Data.TrieMap.html#TrieMap"><span class="hs-identifier hs-type">TrieMap</span></a></span><span> </span><span class="annot"><a href="../../containers/src/Data.IntMap.Internal.html#IntMap"><span class="hs-identifier hs-type">IntMap.IntMap</span></a></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-119"></span><span>  </span><span class="hs-keyword">type</span><span> </span><span id="Key"><span class="annot"><a href="GHC.Data.TrieMap.html#Key"><span class="hs-identifier hs-var">Key</span></a></span></span><span> </span><span class="annot"><a href="../../containers/src/Data.IntMap.Internal.html#IntMap"><span class="hs-identifier hs-type">IntMap.IntMap</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span>
</span><span id="line-120"></span><span>  </span><span id="local-6989586621680857534"><span class="annot"><span class="annottext">emptyTM :: forall a. IntMap a
</span><a href="#local-6989586621680857534"><span class="hs-identifier hs-var hs-var hs-var hs-var">emptyTM</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IntMap a
forall a. IntMap a
</span><a href="../../containers/src/Data.IntMap.Internal.html#empty"><span class="hs-identifier hs-var">IntMap.empty</span></a></span><span>
</span><span id="line-121"></span><span>  </span><span id="local-6989586621680857532"><span class="annot"><span class="annottext">lookupTM :: forall b. Key IntMap -&gt; IntMap b -&gt; Maybe b
</span><a href="#local-6989586621680857532"><span class="hs-identifier hs-var hs-var hs-var hs-var">lookupTM</span></a></span></span><span> </span><span id="local-6989586621680857531"><span class="annot"><span class="annottext">Key IntMap
</span><a href="#local-6989586621680857531"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span id="local-6989586621680857530"><span class="annot"><span class="annottext">IntMap b
</span><a href="#local-6989586621680857530"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Key -&gt; IntMap b -&gt; Maybe b
forall a. Key -&gt; IntMap a -&gt; Maybe a
</span><a href="../../containers/src/Data.IntMap.Internal.html#lookup"><span class="hs-identifier hs-var">IntMap.lookup</span></a></span><span> </span><span class="annot"><span class="annottext">Key
Key IntMap
</span><a href="#local-6989586621680857531"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap b
</span><a href="#local-6989586621680857530"><span class="hs-identifier hs-var">m</span></a></span><span>
</span><span id="line-122"></span><span>  </span><span id="local-6989586621680857528"><span class="annot"><span class="annottext">alterTM :: forall b. Key IntMap -&gt; XT b -&gt; IntMap b -&gt; IntMap b
</span><a href="#local-6989586621680857528"><span class="hs-identifier hs-var hs-var hs-var hs-var">alterTM</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Key IntMap -&gt; (Maybe b -&gt; Maybe b) -&gt; IntMap b -&gt; IntMap b
forall a. Key -&gt; XT a -&gt; IntMap a -&gt; IntMap a
</span><a href="GHC.Data.TrieMap.html#xtInt"><span class="hs-identifier hs-var">xtInt</span></a></span><span>
</span><span id="line-123"></span><span>  </span><span id="local-6989586621680857526"><span class="annot"><span class="annottext">foldTM :: forall a b. (a -&gt; b -&gt; b) -&gt; IntMap a -&gt; b -&gt; b
</span><a href="#local-6989586621680857526"><span class="hs-identifier hs-var hs-var hs-var hs-var">foldTM</span></a></span></span><span> </span><span id="local-6989586621680857525"><span class="annot"><span class="annottext">a -&gt; b -&gt; b
</span><a href="#local-6989586621680857525"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span id="local-6989586621680857524"><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621680857524"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span id="local-6989586621680857523"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621680857523"><span class="hs-identifier hs-var">z</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a -&gt; b -&gt; b) -&gt; b -&gt; IntMap a -&gt; b
forall a b. (a -&gt; b -&gt; b) -&gt; b -&gt; IntMap a -&gt; b
</span><a href="../../containers/src/Data.IntMap.Internal.html#foldr"><span class="hs-identifier hs-var">IntMap.foldr</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; b -&gt; b
</span><a href="#local-6989586621680857525"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621680857523"><span class="hs-identifier hs-var">z</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621680857524"><span class="hs-identifier hs-var">m</span></a></span><span>
</span><span id="line-124"></span><span>  </span><span id="local-6989586621680857521"><span class="annot"><span class="annottext">mapTM :: forall a b. (a -&gt; b) -&gt; IntMap a -&gt; IntMap b
</span><a href="#local-6989586621680857521"><span class="hs-identifier hs-var hs-var hs-var hs-var">mapTM</span></a></span></span><span> </span><span id="local-6989586621680857520"><span class="annot"><span class="annottext">a -&gt; b
</span><a href="#local-6989586621680857520"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621680857519"><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621680857519"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a -&gt; b) -&gt; IntMap a -&gt; IntMap b
forall a b. (a -&gt; b) -&gt; IntMap a -&gt; IntMap b
</span><a href="../../containers/src/Data.IntMap.Internal.html#map"><span class="hs-identifier hs-var">IntMap.map</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; b
</span><a href="#local-6989586621680857520"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621680857519"><span class="hs-identifier hs-var">m</span></a></span><span>
</span><span id="line-125"></span><span>
</span><span id="line-126"></span><span id="local-6989586621680857781"><span class="annot"><a href="GHC.Data.TrieMap.html#xtInt"><span class="hs-identifier hs-type">xtInt</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.TrieMap.html#XT"><span class="hs-identifier hs-type">XT</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857781"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../containers/src/Data.IntMap.Internal.html#IntMap"><span class="hs-identifier hs-type">IntMap.IntMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857781"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../containers/src/Data.IntMap.Internal.html#IntMap"><span class="hs-identifier hs-type">IntMap.IntMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857781"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-127"></span><span id="xtInt"><span class="annot"><span class="annottext">xtInt :: forall a. Key -&gt; XT a -&gt; IntMap a -&gt; IntMap a
</span><a href="GHC.Data.TrieMap.html#xtInt"><span class="hs-identifier hs-var hs-var">xtInt</span></a></span></span><span> </span><span id="local-6989586621680857517"><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621680857517"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span id="local-6989586621680857516"><span class="annot"><span class="annottext">XT a
</span><a href="#local-6989586621680857516"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621680857515"><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621680857515"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">XT a -&gt; Key -&gt; IntMap a -&gt; IntMap a
forall a. (Maybe a -&gt; Maybe a) -&gt; Key -&gt; IntMap a -&gt; IntMap a
</span><a href="../../containers/src/Data.IntMap.Internal.html#alter"><span class="hs-identifier hs-var">IntMap.alter</span></a></span><span> </span><span class="annot"><span class="annottext">XT a
</span><a href="#local-6989586621680857516"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">Key
</span><a href="#local-6989586621680857517"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">IntMap a
</span><a href="#local-6989586621680857515"><span class="hs-identifier hs-var">m</span></a></span><span>
</span><span id="line-128"></span><span>
</span><span id="line-129"></span><span id="local-6989586621680857770"><span class="hs-keyword">instance</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Ord</span></span><span> </span><span class="annot"><a href="#local-6989586621680857770"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="GHC.Data.TrieMap.html#TrieMap"><span class="hs-identifier hs-type">TrieMap</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../containers/src/Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map.Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857770"><span class="hs-identifier hs-type">k</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-130"></span><span>  </span><span class="hs-keyword">type</span><span> </span><span id="Key"><span class="annot"><a href="GHC.Data.TrieMap.html#Key"><span class="hs-identifier hs-var">Key</span></a></span></span><span> </span><span id="local-6989586621680857770"><span class="hs-special">(</span><span class="annot"><a href="../../containers/src/Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map.Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857770"><span class="hs-identifier hs-type">k</span></a></span><span class="hs-special">)</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="#local-6989586621680857770"><span class="hs-identifier hs-type">k</span></a></span><span>
</span><span id="line-131"></span><span>  </span><span id="local-6989586621680857506"><span class="annot"><span class="annottext">emptyTM :: forall a. Map k a
</span><a href="#local-6989586621680857506"><span class="hs-identifier hs-var hs-var hs-var hs-var">emptyTM</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Map k a
forall k a. Map k a
</span><a href="../../containers/src/Data.Map.Internal.html#empty"><span class="hs-identifier hs-var">Map.empty</span></a></span><span>
</span><span id="line-132"></span><span>  </span><span id="local-6989586621680857503"><span class="annot"><span class="annottext">lookupTM :: forall b. Key (Map k) -&gt; Map k b -&gt; Maybe b
</span><a href="#local-6989586621680857503"><span class="hs-identifier hs-var hs-var hs-var hs-var">lookupTM</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Key (Map k) -&gt; Map k b -&gt; Maybe b
forall k a. Ord k =&gt; k -&gt; Map k a -&gt; Maybe a
</span><a href="../../containers/src/Data.Map.Internal.html#lookup"><span class="hs-identifier hs-var">Map.lookup</span></a></span><span>
</span><span id="line-133"></span><span>  </span><span id="local-6989586621680857500"><span class="annot"><span class="annottext">alterTM :: forall b. Key (Map k) -&gt; XT b -&gt; Map k b -&gt; Map k b
</span><a href="#local-6989586621680857500"><span class="hs-identifier hs-var hs-var hs-var hs-var">alterTM</span></a></span></span><span> </span><span id="local-6989586621680857499"><span class="annot"><span class="annottext">Key (Map k)
</span><a href="#local-6989586621680857499"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span id="local-6989586621680857498"><span class="annot"><span class="annottext">XT b
</span><a href="#local-6989586621680857498"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621680857497"><span class="annot"><span class="annottext">Map k b
</span><a href="#local-6989586621680857497"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">XT b -&gt; k -&gt; Map k b -&gt; Map k b
forall k a.
Ord k =&gt;
(Maybe a -&gt; Maybe a) -&gt; k -&gt; Map k a -&gt; Map k a
</span><a href="../../containers/src/Data.Map.Internal.html#alter"><span class="hs-identifier hs-var">Map.alter</span></a></span><span> </span><span class="annot"><span class="annottext">XT b
</span><a href="#local-6989586621680857498"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">k
Key (Map k)
</span><a href="#local-6989586621680857499"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">Map k b
</span><a href="#local-6989586621680857497"><span class="hs-identifier hs-var">m</span></a></span><span>
</span><span id="line-134"></span><span>  </span><span id="local-6989586621680857495"><span class="annot"><span class="annottext">foldTM :: forall a b. (a -&gt; b -&gt; b) -&gt; Map k a -&gt; b -&gt; b
</span><a href="#local-6989586621680857495"><span class="hs-identifier hs-var hs-var hs-var hs-var">foldTM</span></a></span></span><span> </span><span id="local-6989586621680857494"><span class="annot"><span class="annottext">a -&gt; b -&gt; b
</span><a href="#local-6989586621680857494"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span id="local-6989586621680857493"><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621680857493"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span id="local-6989586621680857492"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621680857492"><span class="hs-identifier hs-var">z</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a -&gt; b -&gt; b) -&gt; b -&gt; Map k a -&gt; b
forall a b k. (a -&gt; b -&gt; b) -&gt; b -&gt; Map k a -&gt; b
</span><a href="../../containers/src/Data.Map.Internal.html#foldr"><span class="hs-identifier hs-var">Map.foldr</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; b -&gt; b
</span><a href="#local-6989586621680857494"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621680857492"><span class="hs-identifier hs-var">z</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621680857493"><span class="hs-identifier hs-var">m</span></a></span><span>
</span><span id="line-135"></span><span>  </span><span id="local-6989586621680857490"><span class="annot"><span class="annottext">mapTM :: forall a b. (a -&gt; b) -&gt; Map k a -&gt; Map k b
</span><a href="#local-6989586621680857490"><span class="hs-identifier hs-var hs-var hs-var hs-var">mapTM</span></a></span></span><span> </span><span id="local-6989586621680857489"><span class="annot"><span class="annottext">a -&gt; b
</span><a href="#local-6989586621680857489"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621680857488"><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621680857488"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a -&gt; b) -&gt; Map k a -&gt; Map k b
forall a b k. (a -&gt; b) -&gt; Map k a -&gt; Map k b
</span><a href="../../containers/src/Data.Map.Internal.html#map"><span class="hs-identifier hs-var">Map.map</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; b
</span><a href="#local-6989586621680857489"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621680857488"><span class="hs-identifier hs-var">m</span></a></span></span><span>
</span><span id="line-136"></span><span>
</span><span id="line-137"></span><span>
</span><span id="line-138"></span><span class="hs-comment">{-
Note [foldTM determinism]
~~~~~~~~~~~~~~~~~~~~~~~~~
We want foldTM to be deterministic, which is why we have an instance of
TrieMap for UniqDFM, but not for UniqFM. Here's an example of some things that
go wrong if foldTM is nondeterministic. Consider:

  f a b = return (a &lt;&gt; b)

Depending on the order that the typechecker generates constraints you
get either:

  f :: (Monad m, Monoid a) =&gt; a -&gt; a -&gt; m a

or:

  f :: (Monoid a, Monad m) =&gt; a -&gt; a -&gt; m a

The generated code will be different after desugaring as the dictionaries
will be bound in different orders, leading to potential ABI incompatibility.

One way to solve this would be to notice that the typeclasses could be
sorted alphabetically.

Unfortunately that doesn't quite work with this example:

  f a b = let x = a &lt;&gt; a; y = b &lt;&gt; b in x

where you infer:

  f :: (Monoid m, Monoid m1) =&gt; m1 -&gt; m -&gt; m1

or:

  f :: (Monoid m1, Monoid m) =&gt; m1 -&gt; m -&gt; m1

Here you could decide to take the order of the type variables in the type
according to depth first traversal and use it to order the constraints.

The real trouble starts when the user enables incoherent instances and
the compiler has to make an arbitrary choice. Consider:

  class T a b where
    go :: a -&gt; b -&gt; String

  instance (Show b) =&gt; T Int b where
    go a b = show a ++ show b

  instance (Show a) =&gt; T a Bool where
    go a b = show a ++ show b

  f = go 10 True

GHC is free to choose either dictionary to implement f, but for the sake of
determinism we'd like it to be consistent when compiling the same sources
with the same flags.

inert_dicts :: DictMap is implemented with a TrieMap. In getUnsolvedInerts it
gets converted to a bag of (Wanted) Cts using a fold. Then in
solve_simple_wanteds it's merged with other WantedConstraints. We want the
conversion to a bag to be deterministic. For that purpose we use UniqDFM
instead of UniqFM to implement the TrieMap.

See Note [Deterministic UniqFM] in GHC.Types.Unique.DFM for more details on how it's made
deterministic.
-}</span><span>
</span><span id="line-204"></span><span>
</span><span id="line-205"></span><span class="hs-keyword">instance</span><span> </span><span class="hs-keyword">forall</span><span> </span><span id="local-6989586621680857747"><span class="annot"><a href="#local-6989586621680857747"><span class="hs-identifier hs-type">key</span></a></span></span><span class="hs-operator">.</span><span> </span><span class="annot"><a href="GHC.Types.Unique.html#Uniquable"><span class="hs-identifier hs-type">Uniquable</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857747"><span class="hs-identifier hs-type">key</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="GHC.Data.TrieMap.html#TrieMap"><span class="hs-identifier hs-type">TrieMap</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Unique.DFM.html#UniqDFM"><span class="hs-identifier hs-type">UniqDFM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857747"><span class="hs-identifier hs-type">key</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-206"></span><span>  </span><span class="hs-keyword">type</span><span> </span><span id="Key"><span class="annot"><a href="GHC.Data.TrieMap.html#Key"><span class="hs-identifier hs-var">Key</span></a></span></span><span> </span><span id="local-6989586621680857747"><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Unique.DFM.html#UniqDFM"><span class="hs-identifier hs-type">UniqDFM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857747"><span class="hs-identifier hs-type">key</span></a></span><span class="hs-special">)</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="#local-6989586621680857747"><span class="hs-identifier hs-type">key</span></a></span><span>
</span><span id="line-207"></span><span>  </span><span id="local-6989586621680857479"><span class="annot"><span class="annottext">emptyTM :: forall a. UniqDFM key a
</span><a href="#local-6989586621680857479"><span class="hs-identifier hs-var hs-var hs-var hs-var">emptyTM</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">UniqDFM key a
forall key elt. UniqDFM key elt
</span><a href="GHC.Types.Unique.DFM.html#emptyUDFM"><span class="hs-identifier hs-var">emptyUDFM</span></a></span><span>
</span><span id="line-208"></span><span>  </span><span id="local-6989586621680857476"><span class="annot"><span class="annottext">lookupTM :: forall b. Key (UniqDFM key) -&gt; UniqDFM key b -&gt; Maybe b
</span><a href="#local-6989586621680857476"><span class="hs-identifier hs-var hs-var hs-var hs-var">lookupTM</span></a></span></span><span> </span><span id="local-6989586621680857475"><span class="annot"><span class="annottext">Key (UniqDFM key)
</span><a href="#local-6989586621680857475"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span id="local-6989586621680857474"><span class="annot"><span class="annottext">UniqDFM key b
</span><a href="#local-6989586621680857474"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">UniqDFM key b -&gt; key -&gt; Maybe b
forall key elt.
Uniquable key =&gt;
UniqDFM key elt -&gt; key -&gt; Maybe elt
</span><a href="GHC.Types.Unique.DFM.html#lookupUDFM"><span class="hs-identifier hs-var">lookupUDFM</span></a></span><span> </span><span class="annot"><span class="annottext">UniqDFM key b
</span><a href="#local-6989586621680857474"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="annot"><span class="annottext">key
Key (UniqDFM key)
</span><a href="#local-6989586621680857475"><span class="hs-identifier hs-var">k</span></a></span><span>
</span><span id="line-209"></span><span>  </span><span id="local-6989586621680857471"><span class="annot"><span class="annottext">alterTM :: forall b.
Key (UniqDFM key) -&gt; XT b -&gt; UniqDFM key b -&gt; UniqDFM key b
</span><a href="#local-6989586621680857471"><span class="hs-identifier hs-var hs-var hs-var hs-var">alterTM</span></a></span></span><span> </span><span id="local-6989586621680857470"><span class="annot"><span class="annottext">Key (UniqDFM key)
</span><a href="#local-6989586621680857470"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span id="local-6989586621680857469"><span class="annot"><span class="annottext">XT b
</span><a href="#local-6989586621680857469"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621680857468"><span class="annot"><span class="annottext">UniqDFM key b
</span><a href="#local-6989586621680857468"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">XT b -&gt; UniqDFM key b -&gt; key -&gt; UniqDFM key b
forall key elt.
Uniquable key =&gt;
(Maybe elt -&gt; Maybe elt)
-&gt; UniqDFM key elt -&gt; key -&gt; UniqDFM key elt
</span><a href="GHC.Types.Unique.DFM.html#alterUDFM"><span class="hs-identifier hs-var">alterUDFM</span></a></span><span> </span><span class="annot"><span class="annottext">XT b
</span><a href="#local-6989586621680857469"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">UniqDFM key b
</span><a href="#local-6989586621680857468"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="annot"><span class="annottext">key
Key (UniqDFM key)
</span><a href="#local-6989586621680857470"><span class="hs-identifier hs-var">k</span></a></span><span>
</span><span id="line-210"></span><span>  </span><span id="local-6989586621680857466"><span class="annot"><span class="annottext">foldTM :: forall a b. (a -&gt; b -&gt; b) -&gt; UniqDFM key a -&gt; b -&gt; b
</span><a href="#local-6989586621680857466"><span class="hs-identifier hs-var hs-var hs-var hs-var">foldTM</span></a></span></span><span> </span><span id="local-6989586621680857465"><span class="annot"><span class="annottext">a -&gt; b -&gt; b
</span><a href="#local-6989586621680857465"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span id="local-6989586621680857464"><span class="annot"><span class="annottext">UniqDFM key a
</span><a href="#local-6989586621680857464"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span id="local-6989586621680857463"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621680857463"><span class="hs-identifier hs-var">z</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a -&gt; b -&gt; b) -&gt; b -&gt; UniqDFM key a -&gt; b
forall elt a key. (elt -&gt; a -&gt; a) -&gt; a -&gt; UniqDFM key elt -&gt; a
</span><a href="GHC.Types.Unique.DFM.html#foldUDFM"><span class="hs-identifier hs-var">foldUDFM</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; b -&gt; b
</span><a href="#local-6989586621680857465"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621680857463"><span class="hs-identifier hs-var">z</span></a></span><span> </span><span class="annot"><span class="annottext">UniqDFM key a
</span><a href="#local-6989586621680857464"><span class="hs-identifier hs-var">m</span></a></span><span>
</span><span id="line-211"></span><span>  </span><span id="local-6989586621680857461"><span class="annot"><span class="annottext">mapTM :: forall a b. (a -&gt; b) -&gt; UniqDFM key a -&gt; UniqDFM key b
</span><a href="#local-6989586621680857461"><span class="hs-identifier hs-var hs-var hs-var hs-var">mapTM</span></a></span></span><span> </span><span id="local-6989586621680857460"><span class="annot"><span class="annottext">a -&gt; b
</span><a href="#local-6989586621680857460"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621680857459"><span class="annot"><span class="annottext">UniqDFM key a
</span><a href="#local-6989586621680857459"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a -&gt; b) -&gt; UniqDFM key a -&gt; UniqDFM key b
forall elt1 elt2 key.
(elt1 -&gt; elt2) -&gt; UniqDFM key elt1 -&gt; UniqDFM key elt2
</span><a href="GHC.Types.Unique.DFM.html#mapUDFM"><span class="hs-identifier hs-var">mapUDFM</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; b
</span><a href="#local-6989586621680857460"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">UniqDFM key a
</span><a href="#local-6989586621680857459"><span class="hs-identifier hs-var">m</span></a></span><span>
</span><span id="line-212"></span><span>
</span><span id="line-213"></span><span class="hs-comment">{-
************************************************************************
*                                                                      *
                   Maybes
*                                                                      *
************************************************************************

If              m is a map from k -&gt; val
then (MaybeMap m) is a map from (Maybe k) -&gt; val
-}</span><span>
</span><span id="line-223"></span><span>
</span><span id="line-224"></span><span class="hs-keyword">data</span><span> </span><span id="MaybeMap"><span class="annot"><a href="GHC.Data.TrieMap.html#MaybeMap"><span class="hs-identifier hs-var">MaybeMap</span></a></span></span><span> </span><span id="local-6989586621680857727"><span class="annot"><a href="#local-6989586621680857727"><span class="hs-identifier hs-type">m</span></a></span></span><span> </span><span id="local-6989586621680857726"><span class="annot"><a href="#local-6989586621680857726"><span class="hs-identifier hs-type">a</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="MM"><span class="annot"><a href="GHC.Data.TrieMap.html#MM"><span class="hs-identifier hs-var">MM</span></a></span></span><span> </span><span class="hs-special">{</span><span> </span><span id="mm_nothing"><span class="annot"><span class="annottext">forall (m :: * -&gt; *) a. MaybeMap m a -&gt; Maybe a
</span><a href="GHC.Data.TrieMap.html#mm_nothing"><span class="hs-identifier hs-var hs-var">mm_nothing</span></a></span></span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857726"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span> </span><span id="mm_just"><span class="annot"><span class="annottext">forall (m :: * -&gt; *) a. MaybeMap m a -&gt; m a
</span><a href="GHC.Data.TrieMap.html#mm_just"><span class="hs-identifier hs-var hs-var">mm_just</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="#local-6989586621680857727"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857726"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-225"></span><span>
</span><span id="line-226"></span><span id="local-6989586621680857719"><span class="hs-keyword">instance</span><span> </span><span class="annot"><a href="GHC.Data.TrieMap.html#TrieMap"><span class="hs-identifier hs-type">TrieMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857719"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="GHC.Data.TrieMap.html#TrieMap"><span class="hs-identifier hs-type">TrieMap</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.TrieMap.html#MaybeMap"><span class="hs-identifier hs-type">MaybeMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857719"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-227"></span><span>   </span><span class="hs-keyword">type</span><span> </span><span id="Key"><span class="annot"><a href="GHC.Data.TrieMap.html#Key"><span class="hs-identifier hs-var">Key</span></a></span></span><span> </span><span id="local-6989586621680857719"><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.TrieMap.html#MaybeMap"><span class="hs-identifier hs-type">MaybeMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857719"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">)</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.TrieMap.html#Key"><span class="hs-identifier hs-type">Key</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857719"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-228"></span><span>   </span><span id="local-6989586621680857446"><span class="annot"><span class="annottext">emptyTM :: forall a. MaybeMap m a
</span><a href="#local-6989586621680857446"><span class="hs-identifier hs-var hs-var hs-var hs-var">emptyTM</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">MM :: forall (m :: * -&gt; *) a. Maybe a -&gt; m a -&gt; MaybeMap m a
</span><a href="GHC.Data.TrieMap.html#MM"><span class="hs-identifier hs-type">MM</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">mm_nothing :: Maybe a
</span><a href="GHC.Data.TrieMap.html#mm_nothing"><span class="hs-identifier hs-var">mm_nothing</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe a
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">mm_just :: m a
</span><a href="GHC.Data.TrieMap.html#mm_just"><span class="hs-identifier hs-var">mm_just</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">m a
forall (m :: * -&gt; *) a. TrieMap m =&gt; m a
</span><a href="GHC.Data.TrieMap.html#emptyTM"><span class="hs-identifier hs-var">emptyTM</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-229"></span><span>   </span><span id="local-6989586621680857445"><span class="annot"><span class="annottext">lookupTM :: forall b. Key (MaybeMap m) -&gt; MaybeMap m b -&gt; Maybe b
</span><a href="#local-6989586621680857445"><span class="hs-identifier hs-var hs-var hs-var hs-var">lookupTM</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(forall b. Key m -&gt; m b -&gt; Maybe b)
-&gt; Maybe (Key m) -&gt; MaybeMap m b -&gt; Maybe b
forall k (m :: * -&gt; *) a.
(forall b. k -&gt; m b -&gt; Maybe b)
-&gt; Maybe k -&gt; MaybeMap m a -&gt; Maybe a
</span><a href="GHC.Data.TrieMap.html#lkMaybe"><span class="hs-identifier hs-var">lkMaybe</span></a></span><span> </span><span class="annot"><span class="annottext">forall b. Key m -&gt; m b -&gt; Maybe b
forall (m :: * -&gt; *) b. TrieMap m =&gt; Key m -&gt; m b -&gt; Maybe b
</span><a href="GHC.Data.TrieMap.html#lookupTM"><span class="hs-identifier hs-var">lookupTM</span></a></span><span>
</span><span id="line-230"></span><span>   </span><span id="local-6989586621680857442"><span class="annot"><span class="annottext">alterTM :: forall b. Key (MaybeMap m) -&gt; XT b -&gt; MaybeMap m b -&gt; MaybeMap m b
</span><a href="#local-6989586621680857442"><span class="hs-identifier hs-var hs-var hs-var hs-var">alterTM</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(forall b. Key m -&gt; XT b -&gt; m b -&gt; m b)
-&gt; Maybe (Key m)
-&gt; (Maybe b -&gt; Maybe b)
-&gt; MaybeMap m b
-&gt; MaybeMap m b
forall k (m :: * -&gt; *) a.
(forall b. k -&gt; XT b -&gt; m b -&gt; m b)
-&gt; Maybe k -&gt; XT a -&gt; MaybeMap m a -&gt; MaybeMap m a
</span><a href="GHC.Data.TrieMap.html#xtMaybe"><span class="hs-identifier hs-var">xtMaybe</span></a></span><span> </span><span class="annot"><span class="annottext">forall b. Key m -&gt; XT b -&gt; m b -&gt; m b
forall (m :: * -&gt; *) b. TrieMap m =&gt; Key m -&gt; XT b -&gt; m b -&gt; m b
</span><a href="GHC.Data.TrieMap.html#alterTM"><span class="hs-identifier hs-var">alterTM</span></a></span><span>
</span><span id="line-231"></span><span>   </span><span id="local-6989586621680857438"><span class="annot"><span class="annottext">foldTM :: forall a b. (a -&gt; b -&gt; b) -&gt; MaybeMap m a -&gt; b -&gt; b
</span><a href="#local-6989586621680857438"><span class="hs-identifier hs-var hs-var hs-var hs-var">foldTM</span></a></span></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a -&gt; b -&gt; b) -&gt; MaybeMap m a -&gt; b -&gt; b
forall (m :: * -&gt; *) a b.
TrieMap m =&gt;
(a -&gt; b -&gt; b) -&gt; MaybeMap m a -&gt; b -&gt; b
</span><a href="GHC.Data.TrieMap.html#fdMaybe"><span class="hs-identifier hs-var">fdMaybe</span></a></span><span>
</span><span id="line-232"></span><span>   </span><span id="local-6989586621680857435"><span class="annot"><span class="annottext">mapTM :: forall a b. (a -&gt; b) -&gt; MaybeMap m a -&gt; MaybeMap m b
</span><a href="#local-6989586621680857435"><span class="hs-identifier hs-var hs-var hs-var hs-var">mapTM</span></a></span></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a -&gt; b) -&gt; MaybeMap m a -&gt; MaybeMap m b
forall (m :: * -&gt; *) a b.
TrieMap m =&gt;
(a -&gt; b) -&gt; MaybeMap m a -&gt; MaybeMap m b
</span><a href="GHC.Data.TrieMap.html#mapMb"><span class="hs-identifier hs-var">mapMb</span></a></span></span><span>
</span><span id="line-233"></span><span>
</span><span id="line-234"></span><span id="local-6989586621680857698"><span id="local-6989586621680857699"><span id="local-6989586621680857700"><span class="annot"><a href="GHC.Data.TrieMap.html#mapMb"><span class="hs-identifier hs-type">mapMb</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Data.TrieMap.html#TrieMap"><span class="hs-identifier hs-type">TrieMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857700"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680857699"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-glyph">-&gt;</span><span class="annot"><a href="#local-6989586621680857698"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.TrieMap.html#MaybeMap"><span class="hs-identifier hs-type">MaybeMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857700"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857699"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.TrieMap.html#MaybeMap"><span class="hs-identifier hs-type">MaybeMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857700"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857698"><span class="hs-identifier hs-type">b</span></a></span></span></span></span><span>
</span><span id="line-235"></span><span id="mapMb"><span class="annot"><span class="annottext">mapMb :: forall (m :: * -&gt; *) a b.
TrieMap m =&gt;
(a -&gt; b) -&gt; MaybeMap m a -&gt; MaybeMap m b
</span><a href="GHC.Data.TrieMap.html#mapMb"><span class="hs-identifier hs-var hs-var">mapMb</span></a></span></span><span> </span><span id="local-6989586621680857429"><span class="annot"><span class="annottext">a -&gt; b
</span><a href="#local-6989586621680857429"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.TrieMap.html#MM"><span class="hs-identifier hs-type">MM</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">mm_nothing :: forall (m :: * -&gt; *) a. MaybeMap m a -&gt; Maybe a
</span><a href="GHC.Data.TrieMap.html#mm_nothing"><span class="hs-identifier hs-var">mm_nothing</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680857428"><span class="annot"><span class="annottext">Maybe a
</span><a href="#local-6989586621680857428"><span class="hs-identifier hs-var">mn</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">mm_just :: forall (m :: * -&gt; *) a. MaybeMap m a -&gt; m a
</span><a href="GHC.Data.TrieMap.html#mm_just"><span class="hs-identifier hs-var">mm_just</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680857427"><span class="annot"><span class="annottext">m a
</span><a href="#local-6989586621680857427"><span class="hs-identifier hs-var">mj</span></a></span></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-236"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">MM :: forall (m :: * -&gt; *) a. Maybe a -&gt; m a -&gt; MaybeMap m a
</span><a href="GHC.Data.TrieMap.html#MM"><span class="hs-identifier hs-type">MM</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">mm_nothing :: Maybe b
</span><a href="GHC.Data.TrieMap.html#mm_nothing"><span class="hs-identifier hs-var">mm_nothing</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a -&gt; b) -&gt; Maybe a -&gt; Maybe b
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/GHC.Base.html#fmap"><span class="hs-identifier hs-var">fmap</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; b
</span><a href="#local-6989586621680857429"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe a
</span><a href="#local-6989586621680857428"><span class="hs-identifier hs-var">mn</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">mm_just :: m b
</span><a href="GHC.Data.TrieMap.html#mm_just"><span class="hs-identifier hs-var">mm_just</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a -&gt; b) -&gt; m a -&gt; m b
forall (m :: * -&gt; *) a b. TrieMap m =&gt; (a -&gt; b) -&gt; m a -&gt; m b
</span><a href="GHC.Data.TrieMap.html#mapTM"><span class="hs-identifier hs-var">mapTM</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; b
</span><a href="#local-6989586621680857429"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">m a
</span><a href="#local-6989586621680857427"><span class="hs-identifier hs-var">mj</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-237"></span><span>
</span><span id="line-238"></span><span id="local-6989586621680857713"><span id="local-6989586621680857714"><span id="local-6989586621680857715"><span class="annot"><a href="GHC.Data.TrieMap.html#lkMaybe"><span class="hs-identifier hs-type">lkMaybe</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="hs-keyword">forall</span><span> </span><span id="local-6989586621680857716"><span class="annot"><a href="#local-6989586621680857716"><span class="hs-identifier hs-type">b</span></a></span></span><span class="hs-operator">.</span><span> </span><span class="annot"><a href="#local-6989586621680857715"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680857714"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857716"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857716"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-239"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857715"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.TrieMap.html#MaybeMap"><span class="hs-identifier hs-type">MaybeMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857714"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857713"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857713"><span class="hs-identifier hs-type">a</span></a></span></span></span></span><span>
</span><span id="line-240"></span><span id="lkMaybe"><span class="annot"><span class="annottext">lkMaybe :: forall k (m :: * -&gt; *) a.
(forall b. k -&gt; m b -&gt; Maybe b)
-&gt; Maybe k -&gt; MaybeMap m a -&gt; Maybe a
</span><a href="GHC.Data.TrieMap.html#lkMaybe"><span class="hs-identifier hs-var hs-var">lkMaybe</span></a></span></span><span> </span><span class="annot"><span class="annottext">forall b. k -&gt; m b -&gt; Maybe b
</span><span class="hs-identifier">_</span></span><span>  </span><span class="annot"><span class="annottext">Maybe k
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">MaybeMap m a -&gt; Maybe a
forall (m :: * -&gt; *) a. MaybeMap m a -&gt; Maybe a
</span><a href="GHC.Data.TrieMap.html#mm_nothing"><span class="hs-identifier hs-var hs-var">mm_nothing</span></a></span><span>
</span><span id="line-241"></span><span class="annot"><a href="GHC.Data.TrieMap.html#lkMaybe"><span class="hs-identifier hs-var">lkMaybe</span></a></span><span> </span><span id="local-6989586621680857426"><span class="annot"><span class="annottext">forall b. k -&gt; m b -&gt; Maybe b
</span><a href="#local-6989586621680857426"><span class="hs-identifier hs-var">lk</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621680857425"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680857425"><span class="hs-identifier hs-var">x</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">MaybeMap m a -&gt; m a
forall (m :: * -&gt; *) a. MaybeMap m a -&gt; m a
</span><a href="GHC.Data.TrieMap.html#mm_just"><span class="hs-identifier hs-var hs-var">mm_just</span></a></span><span> </span><span class="annot"><span class="annottext">(MaybeMap m a -&gt; m a)
-&gt; (m a -&gt; Maybe a) -&gt; MaybeMap m a -&gt; Maybe a
forall a b c. (a -&gt; b) -&gt; (b -&gt; c) -&gt; a -&gt; c
</span><a href="GHC.Data.TrieMap.html#%3E.%3E"><span class="hs-operator hs-var">&gt;.&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">k -&gt; m a -&gt; Maybe a
forall b. k -&gt; m b -&gt; Maybe b
</span><a href="#local-6989586621680857426"><span class="hs-identifier hs-var">lk</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680857425"><span class="hs-identifier hs-var">x</span></a></span><span>
</span><span id="line-242"></span><span>
</span><span id="line-243"></span><span id="local-6989586621680857708"><span id="local-6989586621680857709"><span id="local-6989586621680857710"><span class="annot"><a href="GHC.Data.TrieMap.html#xtMaybe"><span class="hs-identifier hs-type">xtMaybe</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="hs-keyword">forall</span><span> </span><span id="local-6989586621680857711"><span class="annot"><a href="#local-6989586621680857711"><span class="hs-identifier hs-type">b</span></a></span></span><span class="hs-operator">.</span><span> </span><span class="annot"><a href="#local-6989586621680857710"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.TrieMap.html#XT"><span class="hs-identifier hs-type">XT</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857711"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680857709"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857711"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680857709"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857711"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-244"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857710"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.TrieMap.html#XT"><span class="hs-identifier hs-type">XT</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857708"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.TrieMap.html#MaybeMap"><span class="hs-identifier hs-type">MaybeMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857709"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857708"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.TrieMap.html#MaybeMap"><span class="hs-identifier hs-type">MaybeMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857709"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857708"><span class="hs-identifier hs-type">a</span></a></span></span></span></span><span>
</span><span id="line-245"></span><span id="xtMaybe"><span class="annot"><span class="annottext">xtMaybe :: forall k (m :: * -&gt; *) a.
(forall b. k -&gt; XT b -&gt; m b -&gt; m b)
-&gt; Maybe k -&gt; XT a -&gt; MaybeMap m a -&gt; MaybeMap m a
</span><a href="GHC.Data.TrieMap.html#xtMaybe"><span class="hs-identifier hs-var hs-var">xtMaybe</span></a></span></span><span> </span><span class="annot"><span class="annottext">forall b. k -&gt; XT b -&gt; m b -&gt; m b
</span><span class="hs-identifier">_</span></span><span>  </span><span class="annot"><span class="annottext">Maybe k
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>  </span><span id="local-6989586621680857424"><span class="annot"><span class="annottext">XT a
</span><a href="#local-6989586621680857424"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621680857423"><span class="annot"><span class="annottext">MaybeMap m a
</span><a href="#local-6989586621680857423"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">MaybeMap m a
</span><a href="#local-6989586621680857423"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">mm_nothing :: Maybe a
</span><a href="GHC.Data.TrieMap.html#mm_nothing"><span class="hs-identifier hs-var">mm_nothing</span></a></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">XT a
</span><a href="#local-6989586621680857424"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">MaybeMap m a -&gt; Maybe a
forall (m :: * -&gt; *) a. MaybeMap m a -&gt; Maybe a
</span><a href="GHC.Data.TrieMap.html#mm_nothing"><span class="hs-identifier hs-var hs-var">mm_nothing</span></a></span><span> </span><span class="annot"><span class="annottext">MaybeMap m a
</span><a href="#local-6989586621680857423"><span class="hs-identifier hs-var">m</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-246"></span><span class="annot"><a href="GHC.Data.TrieMap.html#xtMaybe"><span class="hs-identifier hs-var">xtMaybe</span></a></span><span> </span><span id="local-6989586621680857422"><span class="annot"><span class="annottext">forall b. k -&gt; XT b -&gt; m b -&gt; m b
</span><a href="#local-6989586621680857422"><span class="hs-identifier hs-var">tr</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621680857421"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680857421"><span class="hs-identifier hs-var">x</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621680857420"><span class="annot"><span class="annottext">XT a
</span><a href="#local-6989586621680857420"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621680857419"><span class="annot"><span class="annottext">MaybeMap m a
</span><a href="#local-6989586621680857419"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">MaybeMap m a
</span><a href="#local-6989586621680857419"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">mm_just :: m a
</span><a href="GHC.Data.TrieMap.html#mm_just"><span class="hs-identifier hs-var">mm_just</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">MaybeMap m a -&gt; m a
forall (m :: * -&gt; *) a. MaybeMap m a -&gt; m a
</span><a href="GHC.Data.TrieMap.html#mm_just"><span class="hs-identifier hs-var hs-var">mm_just</span></a></span><span> </span><span class="annot"><span class="annottext">MaybeMap m a
</span><a href="#local-6989586621680857419"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="annot"><span class="annottext">m a -&gt; (m a -&gt; m a) -&gt; m a
forall a b. a -&gt; (a -&gt; b) -&gt; b
</span><a href="GHC.Data.TrieMap.html#%7C%3E"><span class="hs-operator hs-var">|&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">k -&gt; XT a -&gt; m a -&gt; m a
forall b. k -&gt; XT b -&gt; m b -&gt; m b
</span><a href="#local-6989586621680857422"><span class="hs-identifier hs-var">tr</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680857421"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">XT a
</span><a href="#local-6989586621680857420"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-247"></span><span>
</span><span id="line-248"></span><span id="local-6989586621680857703"><span id="local-6989586621680857704"><span id="local-6989586621680857705"><span class="annot"><a href="GHC.Data.TrieMap.html#fdMaybe"><span class="hs-identifier hs-type">fdMaybe</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Data.TrieMap.html#TrieMap"><span class="hs-identifier hs-type">TrieMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857705"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680857704"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680857703"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680857703"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.TrieMap.html#MaybeMap"><span class="hs-identifier hs-type">MaybeMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857705"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857704"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680857703"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680857703"><span class="hs-identifier hs-type">b</span></a></span></span></span></span><span>
</span><span id="line-249"></span><span id="fdMaybe"><span class="annot"><span class="annottext">fdMaybe :: forall (m :: * -&gt; *) a b.
TrieMap m =&gt;
(a -&gt; b -&gt; b) -&gt; MaybeMap m a -&gt; b -&gt; b
</span><a href="GHC.Data.TrieMap.html#fdMaybe"><span class="hs-identifier hs-var hs-var">fdMaybe</span></a></span></span><span> </span><span id="local-6989586621680857416"><span class="annot"><span class="annottext">a -&gt; b -&gt; b
</span><a href="#local-6989586621680857416"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span id="local-6989586621680857415"><span class="annot"><span class="annottext">MaybeMap m a
</span><a href="#local-6989586621680857415"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a -&gt; b -&gt; b) -&gt; Maybe a -&gt; b -&gt; b
forall a b. (a -&gt; b -&gt; b) -&gt; Maybe a -&gt; b -&gt; b
</span><a href="GHC.Data.TrieMap.html#foldMaybe"><span class="hs-identifier hs-var">foldMaybe</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; b -&gt; b
</span><a href="#local-6989586621680857416"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">MaybeMap m a -&gt; Maybe a
forall (m :: * -&gt; *) a. MaybeMap m a -&gt; Maybe a
</span><a href="GHC.Data.TrieMap.html#mm_nothing"><span class="hs-identifier hs-var hs-var">mm_nothing</span></a></span><span> </span><span class="annot"><span class="annottext">MaybeMap m a
</span><a href="#local-6989586621680857415"><span class="hs-identifier hs-var">m</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-250"></span><span>            </span><span class="annot"><span class="annottext">(b -&gt; b) -&gt; (b -&gt; b) -&gt; b -&gt; b
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">(a -&gt; b -&gt; b) -&gt; m a -&gt; b -&gt; b
forall (m :: * -&gt; *) a b.
TrieMap m =&gt;
(a -&gt; b -&gt; b) -&gt; m a -&gt; b -&gt; b
</span><a href="GHC.Data.TrieMap.html#foldTM"><span class="hs-identifier hs-var">foldTM</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; b -&gt; b
</span><a href="#local-6989586621680857416"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">MaybeMap m a -&gt; m a
forall (m :: * -&gt; *) a. MaybeMap m a -&gt; m a
</span><a href="GHC.Data.TrieMap.html#mm_just"><span class="hs-identifier hs-var hs-var">mm_just</span></a></span><span> </span><span class="annot"><span class="annottext">MaybeMap m a
</span><a href="#local-6989586621680857415"><span class="hs-identifier hs-var">m</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-251"></span><span>
</span><span id="line-252"></span><span class="hs-comment">{-
************************************************************************
*                                                                      *
                   Lists
*                                                                      *
************************************************************************
-}</span><span>
</span><span id="line-259"></span><span>
</span><span id="line-260"></span><span class="hs-keyword">data</span><span> </span><span id="ListMap"><span class="annot"><a href="GHC.Data.TrieMap.html#ListMap"><span class="hs-identifier hs-var">ListMap</span></a></span></span><span> </span><span id="local-6989586621680857680"><span class="annot"><a href="#local-6989586621680857680"><span class="hs-identifier hs-type">m</span></a></span></span><span> </span><span id="local-6989586621680857679"><span class="annot"><a href="#local-6989586621680857679"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-261"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span id="LM"><span class="annot"><a href="GHC.Data.TrieMap.html#LM"><span class="hs-identifier hs-var">LM</span></a></span></span><span> </span><span class="hs-special">{</span><span> </span><span id="lm_nil"><span class="annot"><span class="annottext">forall (m :: * -&gt; *) a. ListMap m a -&gt; Maybe a
</span><a href="GHC.Data.TrieMap.html#lm_nil"><span class="hs-identifier hs-var hs-var">lm_nil</span></a></span></span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857679"><span class="hs-identifier hs-type">a</span></a></span><span>
</span><span id="line-262"></span><span>       </span><span class="hs-special">,</span><span> </span><span id="lm_cons"><span class="annot"><span class="annottext">forall (m :: * -&gt; *) a. ListMap m a -&gt; m (ListMap m a)
</span><a href="GHC.Data.TrieMap.html#lm_cons"><span class="hs-identifier hs-var hs-var">lm_cons</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="#local-6989586621680857680"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.TrieMap.html#ListMap"><span class="hs-identifier hs-type">ListMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857680"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857679"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-263"></span><span>
</span><span id="line-264"></span><span id="local-6989586621680857673"><span class="hs-keyword">instance</span><span> </span><span class="annot"><a href="GHC.Data.TrieMap.html#TrieMap"><span class="hs-identifier hs-type">TrieMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857673"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="GHC.Data.TrieMap.html#TrieMap"><span class="hs-identifier hs-type">TrieMap</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.TrieMap.html#ListMap"><span class="hs-identifier hs-type">ListMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857673"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-265"></span><span>   </span><span class="hs-keyword">type</span><span> </span><span id="Key"><span class="annot"><a href="GHC.Data.TrieMap.html#Key"><span class="hs-identifier hs-var">Key</span></a></span></span><span> </span><span id="local-6989586621680857673"><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.TrieMap.html#ListMap"><span class="hs-identifier hs-type">ListMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857673"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">)</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Data.TrieMap.html#Key"><span class="hs-identifier hs-type">Key</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857673"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-266"></span><span>   </span><span id="local-6989586621680857403"><span class="annot"><span class="annottext">emptyTM :: forall a. ListMap m a
</span><a href="#local-6989586621680857403"><span class="hs-identifier hs-var hs-var hs-var hs-var">emptyTM</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LM :: forall (m :: * -&gt; *) a. Maybe a -&gt; m (ListMap m a) -&gt; ListMap m a
</span><a href="GHC.Data.TrieMap.html#LM"><span class="hs-identifier hs-type">LM</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">lm_nil :: Maybe a
</span><a href="GHC.Data.TrieMap.html#lm_nil"><span class="hs-identifier hs-var">lm_nil</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe a
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">lm_cons :: m (ListMap m a)
</span><a href="GHC.Data.TrieMap.html#lm_cons"><span class="hs-identifier hs-var">lm_cons</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">m (ListMap m a)
forall (m :: * -&gt; *) a. TrieMap m =&gt; m a
</span><a href="GHC.Data.TrieMap.html#emptyTM"><span class="hs-identifier hs-var">emptyTM</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-267"></span><span>   </span><span id="local-6989586621680857401"><span class="annot"><span class="annottext">lookupTM :: forall b. Key (ListMap m) -&gt; ListMap m b -&gt; Maybe b
</span><a href="#local-6989586621680857401"><span class="hs-identifier hs-var hs-var hs-var hs-var">lookupTM</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(forall b. Key m -&gt; m b -&gt; Maybe b)
-&gt; [Key m] -&gt; ListMap m b -&gt; Maybe b
forall (m :: * -&gt; *) k a.
TrieMap m =&gt;
(forall b. k -&gt; m b -&gt; Maybe b) -&gt; [k] -&gt; ListMap m a -&gt; Maybe a
</span><a href="GHC.Data.TrieMap.html#lkList"><span class="hs-identifier hs-var">lkList</span></a></span><span> </span><span class="annot"><span class="annottext">forall b. Key m -&gt; m b -&gt; Maybe b
forall (m :: * -&gt; *) b. TrieMap m =&gt; Key m -&gt; m b -&gt; Maybe b
</span><a href="GHC.Data.TrieMap.html#lookupTM"><span class="hs-identifier hs-var">lookupTM</span></a></span><span>
</span><span id="line-268"></span><span>   </span><span id="local-6989586621680857398"><span class="annot"><span class="annottext">alterTM :: forall b. Key (ListMap m) -&gt; XT b -&gt; ListMap m b -&gt; ListMap m b
</span><a href="#local-6989586621680857398"><span class="hs-identifier hs-var hs-var hs-var hs-var">alterTM</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(forall b. Key m -&gt; XT b -&gt; m b -&gt; m b)
-&gt; [Key m] -&gt; (Maybe b -&gt; Maybe b) -&gt; ListMap m b -&gt; ListMap m b
forall (m :: * -&gt; *) k a.
TrieMap m =&gt;
(forall b. k -&gt; XT b -&gt; m b -&gt; m b)
-&gt; [k] -&gt; XT a -&gt; ListMap m a -&gt; ListMap m a
</span><a href="GHC.Data.TrieMap.html#xtList"><span class="hs-identifier hs-var">xtList</span></a></span><span> </span><span class="annot"><span class="annottext">forall b. Key m -&gt; XT b -&gt; m b -&gt; m b
forall (m :: * -&gt; *) b. TrieMap m =&gt; Key m -&gt; XT b -&gt; m b -&gt; m b
</span><a href="GHC.Data.TrieMap.html#alterTM"><span class="hs-identifier hs-var">alterTM</span></a></span><span>
</span><span id="line-269"></span><span>   </span><span id="local-6989586621680857395"><span class="annot"><span class="annottext">foldTM :: forall a b. (a -&gt; b -&gt; b) -&gt; ListMap m a -&gt; b -&gt; b
</span><a href="#local-6989586621680857395"><span class="hs-identifier hs-var hs-var hs-var hs-var">foldTM</span></a></span></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a -&gt; b -&gt; b) -&gt; ListMap m a -&gt; b -&gt; b
forall (m :: * -&gt; *) a b.
TrieMap m =&gt;
(a -&gt; b -&gt; b) -&gt; ListMap m a -&gt; b -&gt; b
</span><a href="GHC.Data.TrieMap.html#fdList"><span class="hs-identifier hs-var">fdList</span></a></span><span>
</span><span id="line-270"></span><span>   </span><span id="local-6989586621680857392"><span class="annot"><span class="annottext">mapTM :: forall a b. (a -&gt; b) -&gt; ListMap m a -&gt; ListMap m b
</span><a href="#local-6989586621680857392"><span class="hs-identifier hs-var hs-var hs-var hs-var">mapTM</span></a></span></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a -&gt; b) -&gt; ListMap m a -&gt; ListMap m b
forall (m :: * -&gt; *) a b.
TrieMap m =&gt;
(a -&gt; b) -&gt; ListMap m a -&gt; ListMap m b
</span><a href="GHC.Data.TrieMap.html#mapList"><span class="hs-identifier hs-var">mapList</span></a></span></span><span>
</span><span id="line-271"></span><span>
</span><span id="line-272"></span><span id="local-6989586621680857648"><span id="local-6989586621680857649"><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621680857388"><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.TrieMap.html#TrieMap"><span class="hs-identifier hs-type">TrieMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857649"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#Outputable"><span class="hs-identifier hs-type">Outputable</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857648"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#Outputable"><span class="hs-identifier hs-type">Outputable</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.TrieMap.html#ListMap"><span class="hs-identifier hs-type">ListMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857649"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857648"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-273"></span><span>  </span><span id="local-6989586621680857383"><span class="annot"><span class="annottext">ppr :: ListMap m a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var hs-var hs-var hs-var">ppr</span></a></span></span><span> </span><span id="local-6989586621680857381"><span class="annot"><span class="annottext">ListMap m a
</span><a href="#local-6989586621680857381"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;List elts&quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">[a] -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(a -&gt; [a] -&gt; [a]) -&gt; ListMap m a -&gt; [a] -&gt; [a]
forall (m :: * -&gt; *) a b.
TrieMap m =&gt;
(a -&gt; b -&gt; b) -&gt; m a -&gt; b -&gt; b
</span><a href="GHC.Data.TrieMap.html#foldTM"><span class="hs-identifier hs-var">foldTM</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">:</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">ListMap m a
</span><a href="#local-6989586621680857381"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">)</span></span></span><span>
</span><span id="line-274"></span><span>
</span><span id="line-275"></span><span id="local-6989586621680857652"><span id="local-6989586621680857653"><span id="local-6989586621680857654"><span class="annot"><a href="GHC.Data.TrieMap.html#mapList"><span class="hs-identifier hs-type">mapList</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Data.TrieMap.html#TrieMap"><span class="hs-identifier hs-type">TrieMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857654"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680857653"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-glyph">-&gt;</span><span class="annot"><a href="#local-6989586621680857652"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.TrieMap.html#ListMap"><span class="hs-identifier hs-type">ListMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857654"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857653"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.TrieMap.html#ListMap"><span class="hs-identifier hs-type">ListMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857654"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857652"><span class="hs-identifier hs-type">b</span></a></span></span></span></span><span>
</span><span id="line-276"></span><span id="mapList"><span class="annot"><span class="annottext">mapList :: forall (m :: * -&gt; *) a b.
TrieMap m =&gt;
(a -&gt; b) -&gt; ListMap m a -&gt; ListMap m b
</span><a href="GHC.Data.TrieMap.html#mapList"><span class="hs-identifier hs-var hs-var">mapList</span></a></span></span><span> </span><span id="local-6989586621680857374"><span class="annot"><span class="annottext">a -&gt; b
</span><a href="#local-6989586621680857374"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.TrieMap.html#LM"><span class="hs-identifier hs-type">LM</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">lm_nil :: forall (m :: * -&gt; *) a. ListMap m a -&gt; Maybe a
</span><a href="GHC.Data.TrieMap.html#lm_nil"><span class="hs-identifier hs-var">lm_nil</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680857373"><span class="annot"><span class="annottext">Maybe a
</span><a href="#local-6989586621680857373"><span class="hs-identifier hs-var">mnil</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">lm_cons :: forall (m :: * -&gt; *) a. ListMap m a -&gt; m (ListMap m a)
</span><a href="GHC.Data.TrieMap.html#lm_cons"><span class="hs-identifier hs-var">lm_cons</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680857372"><span class="annot"><span class="annottext">m (ListMap m a)
</span><a href="#local-6989586621680857372"><span class="hs-identifier hs-var">mcons</span></a></span></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-277"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LM :: forall (m :: * -&gt; *) a. Maybe a -&gt; m (ListMap m a) -&gt; ListMap m a
</span><a href="GHC.Data.TrieMap.html#LM"><span class="hs-identifier hs-type">LM</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">lm_nil :: Maybe b
</span><a href="GHC.Data.TrieMap.html#lm_nil"><span class="hs-identifier hs-var">lm_nil</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a -&gt; b) -&gt; Maybe a -&gt; Maybe b
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/GHC.Base.html#fmap"><span class="hs-identifier hs-var">fmap</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; b
</span><a href="#local-6989586621680857374"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe a
</span><a href="#local-6989586621680857373"><span class="hs-identifier hs-var">mnil</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">lm_cons :: m (ListMap m b)
</span><a href="GHC.Data.TrieMap.html#lm_cons"><span class="hs-identifier hs-var">lm_cons</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(ListMap m a -&gt; ListMap m b) -&gt; m (ListMap m a) -&gt; m (ListMap m b)
forall (m :: * -&gt; *) a b. TrieMap m =&gt; (a -&gt; b) -&gt; m a -&gt; m b
</span><a href="GHC.Data.TrieMap.html#mapTM"><span class="hs-identifier hs-var">mapTM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(a -&gt; b) -&gt; ListMap m a -&gt; ListMap m b
forall (m :: * -&gt; *) a b. TrieMap m =&gt; (a -&gt; b) -&gt; m a -&gt; m b
</span><a href="GHC.Data.TrieMap.html#mapTM"><span class="hs-identifier hs-var">mapTM</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; b
</span><a href="#local-6989586621680857374"><span class="hs-identifier hs-var">f</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">m (ListMap m a)
</span><a href="#local-6989586621680857372"><span class="hs-identifier hs-var">mcons</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-278"></span><span>
</span><span id="line-279"></span><span id="local-6989586621680857667"><span id="local-6989586621680857668"><span id="local-6989586621680857669"><span class="annot"><a href="GHC.Data.TrieMap.html#lkList"><span class="hs-identifier hs-type">lkList</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Data.TrieMap.html#TrieMap"><span class="hs-identifier hs-type">TrieMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857669"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">(</span><span class="hs-keyword">forall</span><span> </span><span id="local-6989586621680857670"><span class="annot"><a href="#local-6989586621680857670"><span class="hs-identifier hs-type">b</span></a></span></span><span class="hs-operator">.</span><span> </span><span class="annot"><a href="#local-6989586621680857668"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680857669"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857670"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857670"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-280"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680857668"><span class="hs-identifier hs-type">k</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.TrieMap.html#ListMap"><span class="hs-identifier hs-type">ListMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857669"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857667"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857667"><span class="hs-identifier hs-type">a</span></a></span></span></span></span><span>
</span><span id="line-281"></span><span id="lkList"><span class="annot"><span class="annottext">lkList :: forall (m :: * -&gt; *) k a.
TrieMap m =&gt;
(forall b. k -&gt; m b -&gt; Maybe b) -&gt; [k] -&gt; ListMap m a -&gt; Maybe a
</span><a href="GHC.Data.TrieMap.html#lkList"><span class="hs-identifier hs-var hs-var">lkList</span></a></span></span><span> </span><span class="annot"><span class="annottext">forall b. k -&gt; m b -&gt; Maybe b
</span><span class="hs-identifier">_</span></span><span>  </span><span class="hs-special">[</span><span class="hs-special">]</span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ListMap m a -&gt; Maybe a
forall (m :: * -&gt; *) a. ListMap m a -&gt; Maybe a
</span><a href="GHC.Data.TrieMap.html#lm_nil"><span class="hs-identifier hs-var hs-var">lm_nil</span></a></span><span>
</span><span id="line-282"></span><span class="annot"><a href="GHC.Data.TrieMap.html#lkList"><span class="hs-identifier hs-var">lkList</span></a></span><span> </span><span id="local-6989586621680857367"><span class="annot"><span class="annottext">forall b. k -&gt; m b -&gt; Maybe b
</span><a href="#local-6989586621680857367"><span class="hs-identifier hs-var">lk</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680857366"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680857366"><span class="hs-identifier hs-var">x</span></a></span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621680857365"><span class="annot"><span class="annottext">[k]
</span><a href="#local-6989586621680857365"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ListMap m a -&gt; m (ListMap m a)
forall (m :: * -&gt; *) a. ListMap m a -&gt; m (ListMap m a)
</span><a href="GHC.Data.TrieMap.html#lm_cons"><span class="hs-identifier hs-var hs-var">lm_cons</span></a></span><span> </span><span class="annot"><span class="annottext">(ListMap m a -&gt; m (ListMap m a))
-&gt; (m (ListMap m a) -&gt; Maybe a) -&gt; ListMap m a -&gt; Maybe a
forall a b c. (a -&gt; b) -&gt; (b -&gt; c) -&gt; a -&gt; c
</span><a href="GHC.Data.TrieMap.html#%3E.%3E"><span class="hs-operator hs-var">&gt;.&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">k -&gt; m (ListMap m a) -&gt; Maybe (ListMap m a)
forall b. k -&gt; m b -&gt; Maybe b
</span><a href="#local-6989586621680857367"><span class="hs-identifier hs-var">lk</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680857366"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">(m (ListMap m a) -&gt; Maybe (ListMap m a))
-&gt; (ListMap m a -&gt; Maybe a) -&gt; m (ListMap m a) -&gt; Maybe a
forall (m :: * -&gt; *) a b c.
Monad m =&gt;
(a -&gt; m b) -&gt; (b -&gt; m c) -&gt; a -&gt; m c
</span><a href="../../base/src/Control.Monad.html#%3E%3D%3E"><span class="hs-operator hs-var">&gt;=&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">(forall b. k -&gt; m b -&gt; Maybe b) -&gt; [k] -&gt; ListMap m a -&gt; Maybe a
forall (m :: * -&gt; *) k a.
TrieMap m =&gt;
(forall b. k -&gt; m b -&gt; Maybe b) -&gt; [k] -&gt; ListMap m a -&gt; Maybe a
</span><a href="GHC.Data.TrieMap.html#lkList"><span class="hs-identifier hs-var">lkList</span></a></span><span> </span><span class="annot"><span class="annottext">forall b. k -&gt; m b -&gt; Maybe b
</span><a href="#local-6989586621680857367"><span class="hs-identifier hs-var">lk</span></a></span><span> </span><span class="annot"><span class="annottext">[k]
</span><a href="#local-6989586621680857365"><span class="hs-identifier hs-var">xs</span></a></span><span>
</span><span id="line-283"></span><span>
</span><span id="line-284"></span><span id="local-6989586621680857662"><span id="local-6989586621680857663"><span id="local-6989586621680857664"><span class="annot"><a href="GHC.Data.TrieMap.html#xtList"><span class="hs-identifier hs-type">xtList</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Data.TrieMap.html#TrieMap"><span class="hs-identifier hs-type">TrieMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857664"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">(</span><span class="hs-keyword">forall</span><span> </span><span id="local-6989586621680857665"><span class="annot"><a href="#local-6989586621680857665"><span class="hs-identifier hs-type">b</span></a></span></span><span class="hs-operator">.</span><span> </span><span class="annot"><a href="#local-6989586621680857663"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.TrieMap.html#XT"><span class="hs-identifier hs-type">XT</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857665"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680857664"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857665"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680857664"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857665"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-285"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680857663"><span class="hs-identifier hs-type">k</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.TrieMap.html#XT"><span class="hs-identifier hs-type">XT</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857662"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.TrieMap.html#ListMap"><span class="hs-identifier hs-type">ListMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857664"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857662"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.TrieMap.html#ListMap"><span class="hs-identifier hs-type">ListMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857664"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857662"><span class="hs-identifier hs-type">a</span></a></span></span></span></span><span>
</span><span id="line-286"></span><span id="xtList"><span class="annot"><span class="annottext">xtList :: forall (m :: * -&gt; *) k a.
TrieMap m =&gt;
(forall b. k -&gt; XT b -&gt; m b -&gt; m b)
-&gt; [k] -&gt; XT a -&gt; ListMap m a -&gt; ListMap m a
</span><a href="GHC.Data.TrieMap.html#xtList"><span class="hs-identifier hs-var hs-var">xtList</span></a></span></span><span> </span><span class="annot"><span class="annottext">forall b. k -&gt; XT b -&gt; m b -&gt; m b
</span><span class="hs-identifier">_</span></span><span>  </span><span class="hs-special">[</span><span class="hs-special">]</span><span>     </span><span id="local-6989586621680857361"><span class="annot"><span class="annottext">XT a
</span><a href="#local-6989586621680857361"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621680857360"><span class="annot"><span class="annottext">ListMap m a
</span><a href="#local-6989586621680857360"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ListMap m a
</span><a href="#local-6989586621680857360"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">lm_nil :: Maybe a
</span><a href="GHC.Data.TrieMap.html#lm_nil"><span class="hs-identifier hs-var">lm_nil</span></a></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">XT a
</span><a href="#local-6989586621680857361"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ListMap m a -&gt; Maybe a
forall (m :: * -&gt; *) a. ListMap m a -&gt; Maybe a
</span><a href="GHC.Data.TrieMap.html#lm_nil"><span class="hs-identifier hs-var hs-var">lm_nil</span></a></span><span> </span><span class="annot"><span class="annottext">ListMap m a
</span><a href="#local-6989586621680857360"><span class="hs-identifier hs-var">m</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-287"></span><span class="annot"><a href="GHC.Data.TrieMap.html#xtList"><span class="hs-identifier hs-var">xtList</span></a></span><span> </span><span id="local-6989586621680857359"><span class="annot"><span class="annottext">forall b. k -&gt; XT b -&gt; m b -&gt; m b
</span><a href="#local-6989586621680857359"><span class="hs-identifier hs-var">tr</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680857358"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680857358"><span class="hs-identifier hs-var">x</span></a></span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621680857357"><span class="annot"><span class="annottext">[k]
</span><a href="#local-6989586621680857357"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621680857356"><span class="annot"><span class="annottext">XT a
</span><a href="#local-6989586621680857356"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621680857355"><span class="annot"><span class="annottext">ListMap m a
</span><a href="#local-6989586621680857355"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ListMap m a
</span><a href="#local-6989586621680857355"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">lm_cons :: m (ListMap m a)
</span><a href="GHC.Data.TrieMap.html#lm_cons"><span class="hs-identifier hs-var">lm_cons</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ListMap m a -&gt; m (ListMap m a)
forall (m :: * -&gt; *) a. ListMap m a -&gt; m (ListMap m a)
</span><a href="GHC.Data.TrieMap.html#lm_cons"><span class="hs-identifier hs-var hs-var">lm_cons</span></a></span><span> </span><span class="annot"><span class="annottext">ListMap m a
</span><a href="#local-6989586621680857355"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="annot"><span class="annottext">m (ListMap m a)
-&gt; (m (ListMap m a) -&gt; m (ListMap m a)) -&gt; m (ListMap m a)
forall a b. a -&gt; (a -&gt; b) -&gt; b
</span><a href="GHC.Data.TrieMap.html#%7C%3E"><span class="hs-operator hs-var">|&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">k -&gt; XT (ListMap m a) -&gt; m (ListMap m a) -&gt; m (ListMap m a)
forall b. k -&gt; XT b -&gt; m b -&gt; m b
</span><a href="#local-6989586621680857359"><span class="hs-identifier hs-var">tr</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680857358"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">(XT (ListMap m a) -&gt; m (ListMap m a) -&gt; m (ListMap m a))
-&gt; (ListMap m a -&gt; ListMap m a)
-&gt; m (ListMap m a)
-&gt; m (ListMap m a)
forall (m2 :: * -&gt; *) a (m1 :: * -&gt; *).
TrieMap m2 =&gt;
(XT (m2 a) -&gt; m1 (m2 a) -&gt; m1 (m2 a))
-&gt; (m2 a -&gt; m2 a) -&gt; m1 (m2 a) -&gt; m1 (m2 a)
</span><a href="GHC.Data.TrieMap.html#%7C%3E%3E"><span class="hs-operator hs-var">|&gt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">(forall b. k -&gt; XT b -&gt; m b -&gt; m b)
-&gt; [k] -&gt; XT a -&gt; ListMap m a -&gt; ListMap m a
forall (m :: * -&gt; *) k a.
TrieMap m =&gt;
(forall b. k -&gt; XT b -&gt; m b -&gt; m b)
-&gt; [k] -&gt; XT a -&gt; ListMap m a -&gt; ListMap m a
</span><a href="GHC.Data.TrieMap.html#xtList"><span class="hs-identifier hs-var">xtList</span></a></span><span> </span><span class="annot"><span class="annottext">forall b. k -&gt; XT b -&gt; m b -&gt; m b
</span><a href="#local-6989586621680857359"><span class="hs-identifier hs-var">tr</span></a></span><span> </span><span class="annot"><span class="annottext">[k]
</span><a href="#local-6989586621680857357"><span class="hs-identifier hs-var">xs</span></a></span><span> </span><span class="annot"><span class="annottext">XT a
</span><a href="#local-6989586621680857356"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-288"></span><span>
</span><span id="line-289"></span><span class="annot"><a href="GHC.Data.TrieMap.html#fdList"><span class="hs-identifier hs-type">fdList</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-keyword">forall</span><span> </span><span id="local-6989586621680857659"><span class="annot"><a href="#local-6989586621680857659"><span class="hs-identifier hs-type">m</span></a></span></span><span> </span><span id="local-6989586621680857658"><span class="annot"><a href="#local-6989586621680857658"><span class="hs-identifier hs-type">a</span></a></span></span><span> </span><span id="local-6989586621680857657"><span class="annot"><a href="#local-6989586621680857657"><span class="hs-identifier hs-type">b</span></a></span></span><span class="hs-operator">.</span><span> </span><span class="annot"><a href="GHC.Data.TrieMap.html#TrieMap"><span class="hs-identifier hs-type">TrieMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857659"><span class="hs-identifier hs-type">m</span></a></span><span>
</span><span id="line-290"></span><span>       </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680857658"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680857657"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680857657"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.TrieMap.html#ListMap"><span class="hs-identifier hs-type">ListMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857659"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857658"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680857657"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680857657"><span class="hs-identifier hs-type">b</span></a></span><span>
</span><span id="line-291"></span><span id="fdList"><span class="annot"><span class="annottext">fdList :: forall (m :: * -&gt; *) a b.
TrieMap m =&gt;
(a -&gt; b -&gt; b) -&gt; ListMap m a -&gt; b -&gt; b
</span><a href="GHC.Data.TrieMap.html#fdList"><span class="hs-identifier hs-var hs-var">fdList</span></a></span></span><span> </span><span id="local-6989586621680857351"><span class="annot"><span class="annottext">a -&gt; b -&gt; b
</span><a href="#local-6989586621680857351"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span id="local-6989586621680857350"><span class="annot"><span class="annottext">ListMap m a
</span><a href="#local-6989586621680857350"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a -&gt; b -&gt; b) -&gt; Maybe a -&gt; b -&gt; b
forall a b. (a -&gt; b -&gt; b) -&gt; Maybe a -&gt; b -&gt; b
</span><a href="GHC.Data.TrieMap.html#foldMaybe"><span class="hs-identifier hs-var">foldMaybe</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; b -&gt; b
</span><a href="#local-6989586621680857351"><span class="hs-identifier hs-var">k</span></a></span><span>          </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ListMap m a -&gt; Maybe a
forall (m :: * -&gt; *) a. ListMap m a -&gt; Maybe a
</span><a href="GHC.Data.TrieMap.html#lm_nil"><span class="hs-identifier hs-var hs-var">lm_nil</span></a></span><span> </span><span class="annot"><span class="annottext">ListMap m a
</span><a href="#local-6989586621680857350"><span class="hs-identifier hs-var">m</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-292"></span><span>           </span><span class="annot"><span class="annottext">(b -&gt; b) -&gt; (b -&gt; b) -&gt; b -&gt; b
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">(ListMap m a -&gt; b -&gt; b) -&gt; m (ListMap m a) -&gt; b -&gt; b
forall (m :: * -&gt; *) a b.
TrieMap m =&gt;
(a -&gt; b -&gt; b) -&gt; m a -&gt; b -&gt; b
</span><a href="GHC.Data.TrieMap.html#foldTM"><span class="hs-identifier hs-var">foldTM</span></a></span><span>    </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(a -&gt; b -&gt; b) -&gt; ListMap m a -&gt; b -&gt; b
forall (m :: * -&gt; *) a b.
TrieMap m =&gt;
(a -&gt; b -&gt; b) -&gt; ListMap m a -&gt; b -&gt; b
</span><a href="GHC.Data.TrieMap.html#fdList"><span class="hs-identifier hs-var">fdList</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; b -&gt; b
</span><a href="#local-6989586621680857351"><span class="hs-identifier hs-var">k</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ListMap m a -&gt; m (ListMap m a)
forall (m :: * -&gt; *) a. ListMap m a -&gt; m (ListMap m a)
</span><a href="GHC.Data.TrieMap.html#lm_cons"><span class="hs-identifier hs-var hs-var">lm_cons</span></a></span><span> </span><span class="annot"><span class="annottext">ListMap m a
</span><a href="#local-6989586621680857350"><span class="hs-identifier hs-var">m</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-293"></span><span>
</span><span id="line-294"></span><span id="local-6989586621680857681"><span id="local-6989586621680857682"><span class="annot"><a href="GHC.Data.TrieMap.html#foldMaybe"><span class="hs-identifier hs-type">foldMaybe</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680857682"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680857681"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680857681"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857682"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680857681"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680857681"><span class="hs-identifier hs-type">b</span></a></span></span></span><span>
</span><span id="line-295"></span><span id="foldMaybe"><span class="annot"><span class="annottext">foldMaybe :: forall a b. (a -&gt; b -&gt; b) -&gt; Maybe a -&gt; b -&gt; b
</span><a href="GHC.Data.TrieMap.html#foldMaybe"><span class="hs-identifier hs-var hs-var">foldMaybe</span></a></span></span><span> </span><span class="annot"><span class="annottext">a -&gt; b -&gt; b
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>  </span><span id="local-6989586621680857349"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621680857349"><span class="hs-identifier hs-var">b</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621680857349"><span class="hs-identifier hs-var">b</span></a></span><span>
</span><span id="line-296"></span><span class="annot"><a href="GHC.Data.TrieMap.html#foldMaybe"><span class="hs-identifier hs-var">foldMaybe</span></a></span><span> </span><span id="local-6989586621680857348"><span class="annot"><span class="annottext">a -&gt; b -&gt; b
</span><a href="#local-6989586621680857348"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621680857347"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680857347"><span class="hs-identifier hs-var">a</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621680857346"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621680857346"><span class="hs-identifier hs-var">b</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; b -&gt; b
</span><a href="#local-6989586621680857348"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680857347"><span class="hs-identifier hs-var">a</span></a></span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621680857346"><span class="hs-identifier hs-var">b</span></a></span><span>
</span><span id="line-297"></span><span>
</span><span id="line-298"></span><span class="hs-comment">{-
************************************************************************
*                                                                      *
                   Basic maps
*                                                                      *
************************************************************************
-}</span><span>
</span><span id="line-305"></span><span>
</span><span id="line-306"></span><span class="hs-keyword">type</span><span> </span><span id="LiteralMap"><span class="annot"><a href="GHC.Data.TrieMap.html#LiteralMap"><span class="hs-identifier hs-var">LiteralMap</span></a></span></span><span>  </span><span id="local-6989586621680857345"><span class="annot"><a href="#local-6989586621680857345"><span class="hs-identifier hs-type">a</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="../../containers/src/Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map.Map</span></a></span><span> </span><span class="annot"><a href="GHC.Types.Literal.html#Literal"><span class="hs-identifier hs-type">Literal</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857345"><span class="hs-identifier hs-type">a</span></a></span><span>
</span><span id="line-307"></span><span>
</span><span id="line-308"></span><span class="hs-comment">{-
************************************************************************
*                                                                      *
                   GenMap
*                                                                      *
************************************************************************

Note [Compressed TrieMap]
~~~~~~~~~~~~~~~~~~~~~~~~~

The GenMap constructor augments TrieMaps with leaf compression.  This helps
solve the performance problem detailed in #9960: suppose we have a handful
H of entries in a TrieMap, each with a very large key, size K. If you fold over
such a TrieMap you'd expect time O(H). That would certainly be true of an
association list! But with TrieMap we actually have to navigate down a long
singleton structure to get to the elements, so it takes time O(K*H).  This
can really hurt on many type-level computation benchmarks:
see for example T9872d.

The point of a TrieMap is that you need to navigate to the point where only one
key remains, and then things should be fast.  So the point of a SingletonMap
is that, once we are down to a single (key,value) pair, we stop and
just use SingletonMap.

'EmptyMap' provides an even more basic (but essential) optimization: if there is
nothing in the map, don't bother building out the (possibly infinite) recursive
TrieMap structure!

Compressed triemaps are heavily used by GHC.Core.Map. So we have to mark some things
as INLINEABLE to permit specialization.
-}</span><span>
</span><span id="line-339"></span><span>
</span><span id="line-340"></span><span class="hs-keyword">data</span><span> </span><span id="GenMap"><span class="annot"><a href="GHC.Data.TrieMap.html#GenMap"><span class="hs-identifier hs-var">GenMap</span></a></span></span><span> </span><span id="local-6989586621680857623"><span class="annot"><a href="#local-6989586621680857623"><span class="hs-identifier hs-type">m</span></a></span></span><span> </span><span id="local-6989586621680857622"><span class="annot"><a href="#local-6989586621680857622"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-341"></span><span>   </span><span class="hs-glyph">=</span><span> </span><span id="EmptyMap"><span class="annot"><a href="GHC.Data.TrieMap.html#EmptyMap"><span class="hs-identifier hs-var">EmptyMap</span></a></span></span><span>
</span><span id="line-342"></span><span>   </span><span class="hs-glyph">|</span><span> </span><span id="SingletonMap"><span class="annot"><a href="GHC.Data.TrieMap.html#SingletonMap"><span class="hs-identifier hs-var">SingletonMap</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.TrieMap.html#Key"><span class="hs-identifier hs-type">Key</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857623"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><a href="#local-6989586621680857622"><span class="hs-identifier hs-type">a</span></a></span><span>
</span><span id="line-343"></span><span>   </span><span class="hs-glyph">|</span><span> </span><span id="MultiMap"><span class="annot"><a href="GHC.Data.TrieMap.html#MultiMap"><span class="hs-identifier hs-var">MultiMap</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680857623"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857622"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-344"></span><span>
</span><span id="line-345"></span><span id="local-6989586621680857627"><span id="local-6989586621680857628"><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621680857338"><span class="hs-special">(</span><span class="annot"><a href="GHC.Utils.Outputable.html#Outputable"><span class="hs-identifier hs-type">Outputable</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857628"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#Outputable"><span class="hs-identifier hs-type">Outputable</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680857627"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857628"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#Outputable"><span class="hs-identifier hs-type">Outputable</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.TrieMap.html#GenMap"><span class="hs-identifier hs-type">GenMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857627"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857628"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-346"></span><span>  </span><span id="local-6989586621680857335"><span class="annot"><span class="annottext">ppr :: GenMap m a -&gt; SDoc
</span><a href="#local-6989586621680857335"><span class="hs-identifier hs-var hs-var hs-var hs-var">ppr</span></a></span></span><span> </span><span class="annot"><span class="annottext">GenMap m a
</span><a href="GHC.Data.TrieMap.html#EmptyMap"><span class="hs-identifier hs-var">EmptyMap</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Empty map&quot;</span></span><span>
</span><span id="line-347"></span><span>  </span><span class="annot"><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.TrieMap.html#SingletonMap"><span class="hs-identifier hs-type">SingletonMap</span></a></span><span> </span><span class="annot"><span class="annottext">Key m
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621680857334"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680857334"><span class="hs-identifier hs-var">v</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Singleton map&quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680857334"><span class="hs-identifier hs-var">v</span></a></span><span>
</span><span id="line-348"></span><span>  </span><span class="annot"><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.TrieMap.html#MultiMap"><span class="hs-identifier hs-type">MultiMap</span></a></span><span> </span><span id="local-6989586621680857333"><span class="annot"><span class="annottext">m a
</span><a href="#local-6989586621680857333"><span class="hs-identifier hs-var">m</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">m a -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">m a
</span><a href="#local-6989586621680857333"><span class="hs-identifier hs-var">m</span></a></span></span></span><span>
</span><span id="line-349"></span><span>
</span><span id="line-350"></span><span class="hs-comment">-- TODO undecidable instance</span><span>
</span><span id="line-351"></span><span id="local-6989586621680857625"><span class="hs-keyword">instance</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier hs-type">Eq</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.TrieMap.html#Key"><span class="hs-identifier hs-type">Key</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857625"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Data.TrieMap.html#TrieMap"><span class="hs-identifier hs-type">TrieMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857625"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="GHC.Data.TrieMap.html#TrieMap"><span class="hs-identifier hs-type">TrieMap</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.TrieMap.html#GenMap"><span class="hs-identifier hs-type">GenMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857625"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-352"></span><span>   </span><span class="hs-keyword">type</span><span> </span><span id="Key"><span class="annot"><a href="GHC.Data.TrieMap.html#Key"><span class="hs-identifier hs-var">Key</span></a></span></span><span> </span><span id="local-6989586621680857625"><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.TrieMap.html#GenMap"><span class="hs-identifier hs-type">GenMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857625"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">)</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="GHC.Data.TrieMap.html#Key"><span class="hs-identifier hs-type">Key</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857625"><span class="hs-identifier hs-type">m</span></a></span><span>
</span><span id="line-353"></span><span>   </span><span id="local-6989586621680857323"><span class="annot"><span class="annottext">emptyTM :: forall a. GenMap m a
</span><a href="#local-6989586621680857323"><span class="hs-identifier hs-var hs-var hs-var hs-var">emptyTM</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">GenMap m a
forall (m :: * -&gt; *) a. GenMap m a
</span><a href="GHC.Data.TrieMap.html#EmptyMap"><span class="hs-identifier hs-var">EmptyMap</span></a></span><span>
</span><span id="line-354"></span><span>   </span><span id="local-6989586621680857320"><span class="annot"><span class="annottext">lookupTM :: forall b. Key (GenMap m) -&gt; GenMap m b -&gt; Maybe b
</span><a href="#local-6989586621680857320"><span class="hs-identifier hs-var hs-var hs-var hs-var">lookupTM</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Key (GenMap m) -&gt; GenMap m b -&gt; Maybe b
forall (m :: * -&gt; *) a.
(Eq (Key m), TrieMap m) =&gt;
Key m -&gt; GenMap m a -&gt; Maybe a
</span><a href="GHC.Data.TrieMap.html#lkG"><span class="hs-identifier hs-var">lkG</span></a></span><span>
</span><span id="line-355"></span><span>   </span><span id="local-6989586621680857317"><span class="annot"><span class="annottext">alterTM :: forall b. Key (GenMap m) -&gt; XT b -&gt; GenMap m b -&gt; GenMap m b
</span><a href="#local-6989586621680857317"><span class="hs-identifier hs-var hs-var hs-var hs-var">alterTM</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Key (GenMap m) -&gt; (Maybe b -&gt; Maybe b) -&gt; GenMap m b -&gt; GenMap m b
forall (m :: * -&gt; *) a.
(Eq (Key m), TrieMap m) =&gt;
Key m -&gt; XT a -&gt; GenMap m a -&gt; GenMap m a
</span><a href="GHC.Data.TrieMap.html#xtG"><span class="hs-identifier hs-var">xtG</span></a></span><span>
</span><span id="line-356"></span><span>   </span><span id="local-6989586621680857315"><span class="annot"><span class="annottext">foldTM :: forall a b. (a -&gt; b -&gt; b) -&gt; GenMap m a -&gt; b -&gt; b
</span><a href="#local-6989586621680857315"><span class="hs-identifier hs-var hs-var hs-var hs-var">foldTM</span></a></span></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a -&gt; b -&gt; b) -&gt; GenMap m a -&gt; b -&gt; b
forall (m :: * -&gt; *) a b.
TrieMap m =&gt;
(a -&gt; b -&gt; b) -&gt; GenMap m a -&gt; b -&gt; b
</span><a href="GHC.Data.TrieMap.html#fdG"><span class="hs-identifier hs-var">fdG</span></a></span><span>
</span><span id="line-357"></span><span>   </span><span id="local-6989586621680857313"><span class="annot"><span class="annottext">mapTM :: forall a b. (a -&gt; b) -&gt; GenMap m a -&gt; GenMap m b
</span><a href="#local-6989586621680857313"><span class="hs-identifier hs-var hs-var hs-var hs-var">mapTM</span></a></span></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a -&gt; b) -&gt; GenMap m a -&gt; GenMap m b
forall (m :: * -&gt; *) a b.
TrieMap m =&gt;
(a -&gt; b) -&gt; GenMap m a -&gt; GenMap m b
</span><a href="GHC.Data.TrieMap.html#mapG"><span class="hs-identifier hs-var">mapG</span></a></span></span><span>
</span><span id="line-358"></span><span>
</span><span id="line-359"></span><span class="hs-comment">--We want to be able to specialize these functions when defining eg</span><span>
</span><span id="line-360"></span><span class="hs-comment">--tries over (GenMap CoreExpr) which requires INLINEABLE</span><span>
</span><span id="line-361"></span><span>
</span><span id="line-362"></span><span class="hs-pragma">{-# INLINEABLE</span><span> </span><span class="annot"><a href="GHC.Data.TrieMap.html#lkG"><span class="hs-pragma hs-type">lkG</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-363"></span><span id="local-6989586621680857619"><span id="local-6989586621680857620"><span class="annot"><a href="GHC.Data.TrieMap.html#lkG"><span class="hs-identifier hs-type">lkG</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier hs-type">Eq</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.TrieMap.html#Key"><span class="hs-identifier hs-type">Key</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857620"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Data.TrieMap.html#TrieMap"><span class="hs-identifier hs-type">TrieMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857620"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="GHC.Data.TrieMap.html#Key"><span class="hs-identifier hs-type">Key</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857620"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.TrieMap.html#GenMap"><span class="hs-identifier hs-type">GenMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857620"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857619"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857619"><span class="hs-identifier hs-type">a</span></a></span></span></span><span>
</span><span id="line-364"></span><span id="lkG"><span class="annot"><span class="annottext">lkG :: forall (m :: * -&gt; *) a.
(Eq (Key m), TrieMap m) =&gt;
Key m -&gt; GenMap m a -&gt; Maybe a
</span><a href="GHC.Data.TrieMap.html#lkG"><span class="hs-identifier hs-var hs-var">lkG</span></a></span></span><span> </span><span class="annot"><span class="annottext">Key m
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">GenMap m a
</span><a href="GHC.Data.TrieMap.html#EmptyMap"><span class="hs-identifier hs-var">EmptyMap</span></a></span><span>                         </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe a
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-365"></span><span class="annot"><a href="GHC.Data.TrieMap.html#lkG"><span class="hs-identifier hs-var">lkG</span></a></span><span> </span><span id="local-6989586621680857307"><span class="annot"><span class="annottext">Key m
</span><a href="#local-6989586621680857307"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.TrieMap.html#SingletonMap"><span class="hs-identifier hs-type">SingletonMap</span></a></span><span> </span><span id="local-6989586621680857306"><span class="annot"><span class="annottext">Key m
</span><a href="#local-6989586621680857306"><span class="hs-identifier hs-var">k'</span></a></span></span><span> </span><span id="local-6989586621680857305"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680857305"><span class="hs-identifier hs-var">v'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Key m
</span><a href="#local-6989586621680857307"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">Key m -&gt; Key m -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">Key m
</span><a href="#local-6989586621680857306"><span class="hs-identifier hs-var">k'</span></a></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; Maybe a
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680857305"><span class="hs-identifier hs-var">v'</span></a></span><span>
</span><span id="line-366"></span><span>                           </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe a
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-367"></span><span class="annot"><a href="GHC.Data.TrieMap.html#lkG"><span class="hs-identifier hs-var">lkG</span></a></span><span> </span><span id="local-6989586621680857304"><span class="annot"><span class="annottext">Key m
</span><a href="#local-6989586621680857304"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.TrieMap.html#MultiMap"><span class="hs-identifier hs-type">MultiMap</span></a></span><span> </span><span id="local-6989586621680857303"><span class="annot"><span class="annottext">m a
</span><a href="#local-6989586621680857303"><span class="hs-identifier hs-var">m</span></a></span></span><span class="hs-special">)</span><span>                     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Key m -&gt; m a -&gt; Maybe a
forall (m :: * -&gt; *) b. TrieMap m =&gt; Key m -&gt; m b -&gt; Maybe b
</span><a href="GHC.Data.TrieMap.html#lookupTM"><span class="hs-identifier hs-var">lookupTM</span></a></span><span> </span><span class="annot"><span class="annottext">Key m
</span><a href="#local-6989586621680857304"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">m a
</span><a href="#local-6989586621680857303"><span class="hs-identifier hs-var">m</span></a></span><span>
</span><span id="line-368"></span><span>
</span><span id="line-369"></span><span class="hs-pragma">{-# INLINEABLE</span><span> </span><span class="annot"><a href="GHC.Data.TrieMap.html#xtG"><span class="hs-pragma hs-type">xtG</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-370"></span><span id="local-6989586621680857616"><span id="local-6989586621680857617"><span class="annot"><a href="GHC.Data.TrieMap.html#xtG"><span class="hs-identifier hs-type">xtG</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier hs-type">Eq</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.TrieMap.html#Key"><span class="hs-identifier hs-type">Key</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857617"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Data.TrieMap.html#TrieMap"><span class="hs-identifier hs-type">TrieMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857617"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="GHC.Data.TrieMap.html#Key"><span class="hs-identifier hs-type">Key</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857617"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.TrieMap.html#XT"><span class="hs-identifier hs-type">XT</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857616"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.TrieMap.html#GenMap"><span class="hs-identifier hs-type">GenMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857617"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857616"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.TrieMap.html#GenMap"><span class="hs-identifier hs-type">GenMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857617"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857616"><span class="hs-identifier hs-type">a</span></a></span></span></span><span>
</span><span id="line-371"></span><span id="xtG"><span class="annot"><span class="annottext">xtG :: forall (m :: * -&gt; *) a.
(Eq (Key m), TrieMap m) =&gt;
Key m -&gt; XT a -&gt; GenMap m a -&gt; GenMap m a
</span><a href="GHC.Data.TrieMap.html#xtG"><span class="hs-identifier hs-var hs-var">xtG</span></a></span></span><span> </span><span id="local-6989586621680857294"><span class="annot"><span class="annottext">Key m
</span><a href="#local-6989586621680857294"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span id="local-6989586621680857293"><span class="annot"><span class="annottext">XT a
</span><a href="#local-6989586621680857293"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="annot"><span class="annottext">GenMap m a
</span><a href="GHC.Data.TrieMap.html#EmptyMap"><span class="hs-identifier hs-var">EmptyMap</span></a></span><span>
</span><span id="line-372"></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">XT a
</span><a href="#local-6989586621680857293"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe a
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-373"></span><span>        </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621680857292"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680857292"><span class="hs-identifier hs-var">v</span></a></span></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Key m -&gt; a -&gt; GenMap m a
forall (m :: * -&gt; *) a. Key m -&gt; a -&gt; GenMap m a
</span><a href="GHC.Data.TrieMap.html#SingletonMap"><span class="hs-identifier hs-var">SingletonMap</span></a></span><span> </span><span class="annot"><span class="annottext">Key m
</span><a href="#local-6989586621680857294"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680857292"><span class="hs-identifier hs-var">v</span></a></span><span>
</span><span id="line-374"></span><span>        </span><span class="annot"><span class="annottext">Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">GenMap m a
forall (m :: * -&gt; *) a. GenMap m a
</span><a href="GHC.Data.TrieMap.html#EmptyMap"><span class="hs-identifier hs-var">EmptyMap</span></a></span><span>
</span><span id="line-375"></span><span class="annot"><a href="GHC.Data.TrieMap.html#xtG"><span class="hs-identifier hs-var">xtG</span></a></span><span> </span><span id="local-6989586621680857291"><span class="annot"><span class="annottext">Key m
</span><a href="#local-6989586621680857291"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span id="local-6989586621680857290"><span class="annot"><span class="annottext">XT a
</span><a href="#local-6989586621680857290"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621680857289"><span class="annot"><span class="annottext">m :: GenMap m a
</span><a href="#local-6989586621680857289"><span class="hs-identifier hs-var">m</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.TrieMap.html#SingletonMap"><span class="hs-identifier hs-type">SingletonMap</span></a></span><span> </span><span id="local-6989586621680857288"><span class="annot"><span class="annottext">Key m
</span><a href="#local-6989586621680857288"><span class="hs-identifier hs-var">k'</span></a></span></span><span> </span><span id="local-6989586621680857287"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680857287"><span class="hs-identifier hs-var">v'</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-376"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Key m
</span><a href="#local-6989586621680857288"><span class="hs-identifier hs-var">k'</span></a></span><span> </span><span class="annot"><span class="annottext">Key m -&gt; Key m -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">Key m
</span><a href="#local-6989586621680857291"><span class="hs-identifier hs-var">k</span></a></span><span>
</span><span id="line-377"></span><span>    </span><span class="hs-comment">-- The new key matches the (single) key already in the tree.  Hence,</span><span>
</span><span id="line-378"></span><span>    </span><span class="hs-comment">-- apply @f@ to @Just v'@ and build a singleton or empty map depending</span><span>
</span><span id="line-379"></span><span>    </span><span class="hs-comment">-- on the 'Just'/'Nothing' response respectively.</span><span>
</span><span id="line-380"></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">XT a
</span><a href="#local-6989586621680857290"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; Maybe a
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680857287"><span class="hs-identifier hs-var">v'</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-381"></span><span>        </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621680857286"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680857286"><span class="hs-identifier hs-var">v''</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Key m -&gt; a -&gt; GenMap m a
forall (m :: * -&gt; *) a. Key m -&gt; a -&gt; GenMap m a
</span><a href="GHC.Data.TrieMap.html#SingletonMap"><span class="hs-identifier hs-var">SingletonMap</span></a></span><span> </span><span class="annot"><span class="annottext">Key m
</span><a href="#local-6989586621680857288"><span class="hs-identifier hs-var">k'</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680857286"><span class="hs-identifier hs-var">v''</span></a></span><span>
</span><span id="line-382"></span><span>        </span><span class="annot"><span class="annottext">Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">GenMap m a
forall (m :: * -&gt; *) a. GenMap m a
</span><a href="GHC.Data.TrieMap.html#EmptyMap"><span class="hs-identifier hs-var">EmptyMap</span></a></span><span>
</span><span id="line-383"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-384"></span><span>    </span><span class="hs-comment">-- We've hit a singleton tree for a different key than the one we are</span><span>
</span><span id="line-385"></span><span>    </span><span class="hs-comment">-- searching for. Hence apply @f@ to @Nothing@. If result is @Nothing@ then</span><span>
</span><span id="line-386"></span><span>    </span><span class="hs-comment">-- we can just return the old map. If not, we need a map with *two*</span><span>
</span><span id="line-387"></span><span>    </span><span class="hs-comment">-- entries. The easiest way to do that is to insert two items into an empty</span><span>
</span><span id="line-388"></span><span>    </span><span class="hs-comment">-- map of type @m a@.</span><span>
</span><span id="line-389"></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">XT a
</span><a href="#local-6989586621680857290"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe a
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-390"></span><span>        </span><span class="annot"><span class="annottext">Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">GenMap m a
</span><a href="#local-6989586621680857289"><span class="hs-identifier hs-var">m</span></a></span><span>
</span><span id="line-391"></span><span>        </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621680857285"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680857285"><span class="hs-identifier hs-var">v</span></a></span></span><span>   </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">m a
forall (m :: * -&gt; *) a. TrieMap m =&gt; m a
</span><a href="GHC.Data.TrieMap.html#emptyTM"><span class="hs-identifier hs-var">emptyTM</span></a></span><span> </span><span class="annot"><span class="annottext">m a -&gt; (m a -&gt; GenMap m a) -&gt; GenMap m a
forall a b. a -&gt; (a -&gt; b) -&gt; b
</span><a href="GHC.Data.TrieMap.html#%7C%3E"><span class="hs-operator hs-var">|&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">Key m -&gt; XT a -&gt; m a -&gt; m a
forall (m :: * -&gt; *) b. TrieMap m =&gt; Key m -&gt; XT b -&gt; m b -&gt; m b
</span><a href="GHC.Data.TrieMap.html#alterTM"><span class="hs-identifier hs-var">alterTM</span></a></span><span> </span><span class="annot"><span class="annottext">Key m
</span><a href="#local-6989586621680857288"><span class="hs-identifier hs-var">k'</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Maybe a -&gt; XT a
forall a b. a -&gt; b -&gt; a
</span><a href="../../base/src/GHC.Base.html#const"><span class="hs-identifier hs-var">const</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; Maybe a
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680857287"><span class="hs-identifier hs-var">v'</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-392"></span><span>                           </span><span class="annot"><span class="annottext">(m a -&gt; m a) -&gt; (m a -&gt; GenMap m a) -&gt; m a -&gt; GenMap m a
forall a b c. (a -&gt; b) -&gt; (b -&gt; c) -&gt; a -&gt; c
</span><a href="GHC.Data.TrieMap.html#%3E.%3E"><span class="hs-operator hs-var">&gt;.&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">Key m -&gt; XT a -&gt; m a -&gt; m a
forall (m :: * -&gt; *) b. TrieMap m =&gt; Key m -&gt; XT b -&gt; m b -&gt; m b
</span><a href="GHC.Data.TrieMap.html#alterTM"><span class="hs-identifier hs-var">alterTM</span></a></span><span> </span><span class="annot"><span class="annottext">Key m
</span><a href="#local-6989586621680857291"><span class="hs-identifier hs-var">k</span></a></span><span>  </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Maybe a -&gt; XT a
forall a b. a -&gt; b -&gt; a
</span><a href="../../base/src/GHC.Base.html#const"><span class="hs-identifier hs-var">const</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; Maybe a
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680857285"><span class="hs-identifier hs-var">v</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-393"></span><span>                           </span><span class="annot"><span class="annottext">(m a -&gt; m a) -&gt; (m a -&gt; GenMap m a) -&gt; m a -&gt; GenMap m a
forall a b c. (a -&gt; b) -&gt; (b -&gt; c) -&gt; a -&gt; c
</span><a href="GHC.Data.TrieMap.html#%3E.%3E"><span class="hs-operator hs-var">&gt;.&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">m a -&gt; GenMap m a
forall (m :: * -&gt; *) a. m a -&gt; GenMap m a
</span><a href="GHC.Data.TrieMap.html#MultiMap"><span class="hs-identifier hs-var">MultiMap</span></a></span><span>
</span><span id="line-394"></span><span class="annot"><a href="GHC.Data.TrieMap.html#xtG"><span class="hs-identifier hs-var">xtG</span></a></span><span> </span><span id="local-6989586621680857283"><span class="annot"><span class="annottext">Key m
</span><a href="#local-6989586621680857283"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span id="local-6989586621680857282"><span class="annot"><span class="annottext">XT a
</span><a href="#local-6989586621680857282"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.TrieMap.html#MultiMap"><span class="hs-identifier hs-type">MultiMap</span></a></span><span> </span><span id="local-6989586621680857281"><span class="annot"><span class="annottext">m a
</span><a href="#local-6989586621680857281"><span class="hs-identifier hs-var">m</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">m a -&gt; GenMap m a
forall (m :: * -&gt; *) a. m a -&gt; GenMap m a
</span><a href="GHC.Data.TrieMap.html#MultiMap"><span class="hs-identifier hs-var">MultiMap</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Key m -&gt; XT a -&gt; m a -&gt; m a
forall (m :: * -&gt; *) b. TrieMap m =&gt; Key m -&gt; XT b -&gt; m b -&gt; m b
</span><a href="GHC.Data.TrieMap.html#alterTM"><span class="hs-identifier hs-var">alterTM</span></a></span><span> </span><span class="annot"><span class="annottext">Key m
</span><a href="#local-6989586621680857283"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">XT a
</span><a href="#local-6989586621680857282"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">m a
</span><a href="#local-6989586621680857281"><span class="hs-identifier hs-var">m</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-395"></span><span>
</span><span id="line-396"></span><span class="hs-pragma">{-# INLINEABLE</span><span> </span><span class="annot"><a href="GHC.Data.TrieMap.html#mapG"><span class="hs-pragma hs-type">mapG</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-397"></span><span id="local-6989586621680857606"><span id="local-6989586621680857607"><span id="local-6989586621680857608"><span class="annot"><a href="GHC.Data.TrieMap.html#mapG"><span class="hs-identifier hs-type">mapG</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Data.TrieMap.html#TrieMap"><span class="hs-identifier hs-type">TrieMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857608"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680857607"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680857606"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.TrieMap.html#GenMap"><span class="hs-identifier hs-type">GenMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857608"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857607"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.TrieMap.html#GenMap"><span class="hs-identifier hs-type">GenMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857608"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857606"><span class="hs-identifier hs-type">b</span></a></span></span></span></span><span>
</span><span id="line-398"></span><span id="mapG"><span class="annot"><span class="annottext">mapG :: forall (m :: * -&gt; *) a b.
TrieMap m =&gt;
(a -&gt; b) -&gt; GenMap m a -&gt; GenMap m b
</span><a href="GHC.Data.TrieMap.html#mapG"><span class="hs-identifier hs-var hs-var">mapG</span></a></span></span><span> </span><span class="annot"><span class="annottext">a -&gt; b
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">GenMap m a
</span><a href="GHC.Data.TrieMap.html#EmptyMap"><span class="hs-identifier hs-var">EmptyMap</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">GenMap m b
forall (m :: * -&gt; *) a. GenMap m a
</span><a href="GHC.Data.TrieMap.html#EmptyMap"><span class="hs-identifier hs-var">EmptyMap</span></a></span><span>
</span><span id="line-399"></span><span class="annot"><a href="GHC.Data.TrieMap.html#mapG"><span class="hs-identifier hs-var">mapG</span></a></span><span> </span><span id="local-6989586621680857278"><span class="annot"><span class="annottext">a -&gt; b
</span><a href="#local-6989586621680857278"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.TrieMap.html#SingletonMap"><span class="hs-identifier hs-type">SingletonMap</span></a></span><span> </span><span id="local-6989586621680857277"><span class="annot"><span class="annottext">Key m
</span><a href="#local-6989586621680857277"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span id="local-6989586621680857276"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680857276"><span class="hs-identifier hs-var">v</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Key m -&gt; b -&gt; GenMap m b
forall (m :: * -&gt; *) a. Key m -&gt; a -&gt; GenMap m a
</span><a href="GHC.Data.TrieMap.html#SingletonMap"><span class="hs-identifier hs-var">SingletonMap</span></a></span><span> </span><span class="annot"><span class="annottext">Key m
</span><a href="#local-6989586621680857277"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; b
</span><a href="#local-6989586621680857278"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680857276"><span class="hs-identifier hs-var">v</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-400"></span><span class="annot"><a href="GHC.Data.TrieMap.html#mapG"><span class="hs-identifier hs-var">mapG</span></a></span><span> </span><span id="local-6989586621680857275"><span class="annot"><span class="annottext">a -&gt; b
</span><a href="#local-6989586621680857275"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.TrieMap.html#MultiMap"><span class="hs-identifier hs-type">MultiMap</span></a></span><span> </span><span id="local-6989586621680857274"><span class="annot"><span class="annottext">m a
</span><a href="#local-6989586621680857274"><span class="hs-identifier hs-var">m</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">m b -&gt; GenMap m b
forall (m :: * -&gt; *) a. m a -&gt; GenMap m a
</span><a href="GHC.Data.TrieMap.html#MultiMap"><span class="hs-identifier hs-var">MultiMap</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(a -&gt; b) -&gt; m a -&gt; m b
forall (m :: * -&gt; *) a b. TrieMap m =&gt; (a -&gt; b) -&gt; m a -&gt; m b
</span><a href="GHC.Data.TrieMap.html#mapTM"><span class="hs-identifier hs-var">mapTM</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; b
</span><a href="#local-6989586621680857275"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">m a
</span><a href="#local-6989586621680857274"><span class="hs-identifier hs-var">m</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-401"></span><span>
</span><span id="line-402"></span><span class="hs-pragma">{-# INLINEABLE</span><span> </span><span class="annot"><a href="GHC.Data.TrieMap.html#fdG"><span class="hs-pragma hs-type">fdG</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-403"></span><span id="local-6989586621680857611"><span id="local-6989586621680857612"><span id="local-6989586621680857613"><span class="annot"><a href="GHC.Data.TrieMap.html#fdG"><span class="hs-identifier hs-type">fdG</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Data.TrieMap.html#TrieMap"><span class="hs-identifier hs-type">TrieMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857613"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680857612"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680857611"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680857611"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.TrieMap.html#GenMap"><span class="hs-identifier hs-type">GenMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857613"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680857612"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680857611"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680857611"><span class="hs-identifier hs-type">b</span></a></span></span></span></span><span>
</span><span id="line-404"></span><span id="fdG"><span class="annot"><span class="annottext">fdG :: forall (m :: * -&gt; *) a b.
TrieMap m =&gt;
(a -&gt; b -&gt; b) -&gt; GenMap m a -&gt; b -&gt; b
</span><a href="GHC.Data.TrieMap.html#fdG"><span class="hs-identifier hs-var hs-var">fdG</span></a></span></span><span> </span><span class="annot"><span class="annottext">a -&gt; b -&gt; b
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">GenMap m a
</span><a href="GHC.Data.TrieMap.html#EmptyMap"><span class="hs-identifier hs-var">EmptyMap</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621680857271"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621680857271"><span class="hs-identifier hs-var">z</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621680857271"><span class="hs-identifier hs-var">z</span></a></span><span>
</span><span id="line-405"></span><span class="annot"><a href="GHC.Data.TrieMap.html#fdG"><span class="hs-identifier hs-var">fdG</span></a></span><span> </span><span id="local-6989586621680857270"><span class="annot"><span class="annottext">a -&gt; b -&gt; b
</span><a href="#local-6989586621680857270"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.TrieMap.html#SingletonMap"><span class="hs-identifier hs-type">SingletonMap</span></a></span><span> </span><span class="annot"><span class="annottext">Key m
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621680857269"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680857269"><span class="hs-identifier hs-var">v</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621680857268"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621680857268"><span class="hs-identifier hs-var">z</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">a -&gt; b -&gt; b
</span><a href="#local-6989586621680857270"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680857269"><span class="hs-identifier hs-var">v</span></a></span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621680857268"><span class="hs-identifier hs-var">z</span></a></span><span>
</span><span id="line-406"></span><span class="annot"><a href="GHC.Data.TrieMap.html#fdG"><span class="hs-identifier hs-var">fdG</span></a></span><span> </span><span id="local-6989586621680857267"><span class="annot"><span class="annottext">a -&gt; b -&gt; b
</span><a href="#local-6989586621680857267"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.TrieMap.html#MultiMap"><span class="hs-identifier hs-type">MultiMap</span></a></span><span> </span><span id="local-6989586621680857266"><span class="annot"><span class="annottext">m a
</span><a href="#local-6989586621680857266"><span class="hs-identifier hs-var">m</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a -&gt; b -&gt; b) -&gt; m a -&gt; b -&gt; b
forall (m :: * -&gt; *) a b.
TrieMap m =&gt;
(a -&gt; b -&gt; b) -&gt; m a -&gt; b -&gt; b
</span><a href="GHC.Data.TrieMap.html#foldTM"><span class="hs-identifier hs-var">foldTM</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; b -&gt; b
</span><a href="#local-6989586621680857267"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">m a
</span><a href="#local-6989586621680857266"><span class="hs-identifier hs-var">m</span></a></span><span>
</span><span id="line-407"></span></pre></body></html>